File: freq.rb

package info (click to toggle)
ruby-rufus-scheduler 3.8.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 524 kB
  • sloc: ruby: 4,324; makefile: 26
file content (24 lines) | stat: -rw-r--r-- 390 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

require 'benchmark'

$:.unshift('lib')
require 'rufus/scheduler'

N = 10

puts
puts "Ruby: #{RUBY_PLATFORM} #{RUBY_VERSION}"
puts "N is #{N}"
puts

Benchmark.benchmark(Benchmark::Tms::CAPTION, 31) do |b|

  cl = Rufus::Scheduler::CronLine.new('*/2 * * * *')

  b.report('.next_time') do
    N.times { cl.next_time }
  end
  b.report('.frequency') do
    N.times { cl.frequency }
  end
end