Class: Bixby::Bench::Sample
- Inherits:
-
Object
- Object
- Bixby::Bench::Sample
- Defined in:
- lib/bixby/bench/sample.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(label, block, sample_size, memory) ⇒ Sample
constructor
A new instance of Sample.
- #measure ⇒ Object
Constructor Details
#initialize(label, block, sample_size, memory) ⇒ Sample
Returns a new instance of Sample.
8 9 10 11 12 13 |
# File 'lib/bixby/bench/sample.rb', line 8 def initialize(label, block, sample_size, memory) @label = label @block = block @sample_size = sample_size @memory = memory end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
6 7 8 |
# File 'lib/bixby/bench/sample.rb', line 6 def block @block end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
6 7 8 |
# File 'lib/bixby/bench/sample.rb', line 6 def label @label end |
Instance Method Details
#call ⇒ Object
15 16 17 |
# File 'lib/bixby/bench/sample.rb', line 15 def call @block.call end |
#measure ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/bixby/bench/sample.rb', line 19 def measure report = Report.new report.tms = Benchmark.measure { @sample_size.times { self.call } } if @memory then report.allocation_stats = AllocationStats.new(burn: 5).trace { self.call } end return report end |