Class: Benchmark::Avg::Job
- Inherits:
-
Object
- Object
- Benchmark::Avg::Job
- Defined in:
- lib/benchmark/avg/job.rb
Constant Summary collapse
- PRECISION =
2
Instance Method Summary collapse
-
#initialize(label, block) ⇒ Job
constructor
A new instance of Job.
- #run(warmup_time, run_time) ⇒ Object
- #runtime_report ⇒ Object
- #warmup_report ⇒ Object
Constructor Details
#initialize(label, block) ⇒ Job
Returns a new instance of Job.
7 8 9 10 11 12 13 |
# File 'lib/benchmark/avg/job.rb', line 7 def initialize(label, block) @label = label @block = block @warmup_samples = [] @run_samples = [] @warming_up = true end |
Instance Method Details
#run(warmup_time, run_time) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/benchmark/avg/job.rb', line 15 def run(warmup_time, run_time) warmup_finish = Time.now + warmup_time measure_until(@warmup_samples, warmup_finish) finish_warmup suite_finish = Time.now + run_time measure_until(@run_samples, suite_finish) finish_measure end |
#runtime_report ⇒ Object
30 31 32 |
# File 'lib/benchmark/avg/job.rb', line 30 def runtime_report report @run_samples end |
#warmup_report ⇒ Object
26 27 28 |
# File 'lib/benchmark/avg/job.rb', line 26 def warmup_report report @warmup_samples end |