Class: LoadTest::StatRow
- Inherits:
-
Object
- Object
- LoadTest::StatRow
- Defined in:
- lib/load_test/stat_row.rb
Overview
Statistics
Instance Attribute Summary collapse
-
#errors ⇒ Object
An array of errors.
-
#name ⇒ Object
name.
-
#values ⇒ Object
Data array for statistics.
Instance Method Summary collapse
-
#average ⇒ Object
Calculate the average value.
-
#count ⇒ Object
Number of data used for statistics.
-
#error_count ⇒ Object
number of errors.
-
#finish ⇒ Object
This method performs data relocation.
-
#initialize(name) ⇒ StatRow
constructor
Constructor.
-
#median ⇒ Object
Calculate the median value.
-
#percentile(value) ⇒ Object
Calculate the percentile value.
Constructor Details
#initialize(name) ⇒ StatRow
Constructor
11 12 13 14 15 |
# File 'lib/load_test/stat_row.rb', line 11 def initialize(name) @name = name @values = [] @errors = [] end |
Instance Attribute Details
#errors ⇒ Object
An array of errors.
8 9 10 |
# File 'lib/load_test/stat_row.rb', line 8 def errors @errors end |
#name ⇒ Object
name
4 5 6 |
# File 'lib/load_test/stat_row.rb', line 4 def name @name end |
#values ⇒ Object
Data array for statistics.
6 7 8 |
# File 'lib/load_test/stat_row.rb', line 6 def values @values end |
Instance Method Details
#average ⇒ Object
Calculate the average value.
24 25 26 |
# File 'lib/load_test/stat_row.rb', line 24 def average @values.sum / @values.size.to_f end |
#count ⇒ Object
Number of data used for statistics.
40 41 42 |
# File 'lib/load_test/stat_row.rb', line 40 def count @values.size end |
#error_count ⇒ Object
number of errors.
45 46 47 |
# File 'lib/load_test/stat_row.rb', line 45 def error_count @errors.size end |
#finish ⇒ Object
This method performs data relocation. Call when you have finished entering data.
19 20 21 |
# File 'lib/load_test/stat_row.rb', line 19 def finish @values.sort! end |
#median ⇒ Object
Calculate the median value.
35 36 37 |
# File 'lib/load_test/stat_row.rb', line 35 def median percentile(50) end |
#percentile(value) ⇒ Object
Calculate the percentile value.
29 30 31 32 |
# File 'lib/load_test/stat_row.rb', line 29 def percentile(value) index = (@values.size.pred * value / 100.0).round @values[index] end |