Class: Bullshit::Histogram
- Inherits:
-
Object
- Object
- Bullshit::Histogram
- Defined in:
- lib/bullshit.rb
Overview
A histogram gives an overview of measurement time values.
Instance Attribute Summary collapse
-
#bins ⇒ Object
readonly
Number of bins for this Histogram.
Instance Method Summary collapse
-
#display(output = $stdout, width = 50) ⇒ Object
Display this histogram to
output
,width
is the parameter forprepare_display
. -
#initialize(analysis, bins) ⇒ Histogram
constructor
Create a Histogram for
clock
using the measurements fortime
. -
#to_a ⇒ Object
Return the computed histogram as an array of arrays.
Constructor Details
#initialize(analysis, bins) ⇒ Histogram
Create a Histogram for clock
using the measurements for time
.
574 575 576 577 578 |
# File 'lib/bullshit.rb', line 574 def initialize(analysis, bins) @analysis = analysis @bins = bins @result = compute end |
Instance Attribute Details
#bins ⇒ Object (readonly)
Number of bins for this Histogram.
581 582 583 |
# File 'lib/bullshit.rb', line 581 def bins @bins end |
Instance Method Details
#display(output = $stdout, width = 50) ⇒ Object
Display this histogram to output
, width
is the parameter for prepare_display
590 591 592 593 594 595 596 |
# File 'lib/bullshit.rb', line 590 def display(output = $stdout, width = 50) d = prepare_display(width) for l, , r in d output << "%11.5f -|%s\n" % [ (l + r) / 2.0, "*" * ] end self end |
#to_a ⇒ Object
Return the computed histogram as an array of arrays.
584 585 586 |
# File 'lib/bullshit.rb', line 584 def to_a @result end |