Class: Benelux::Tms
Overview
Instance Attribute Summary collapse
-
#cstime ⇒ Object
Returns the value of attribute cstime.
-
#cutime ⇒ Object
Returns the value of attribute cutime.
-
#label ⇒ Object
Returns the value of attribute label.
-
#real ⇒ Object
Returns the value of attribute real.
-
#samples ⇒ Object
readonly
TODO: integrate w/ github.com/copiousfreetime/hitimes.
-
#stime ⇒ Object
Returns the value of attribute stime.
-
#total ⇒ Object
Returns the value of attribute total.
-
#utime ⇒ Object
Returns the value of attribute utime.
Instance Method Summary collapse
-
#initialize(tms = nil) ⇒ Tms
constructor
tms
is a Benchmark::Tms object. - #inspect ⇒ Object
- #sample(tms) ⇒ Object
- #to_f ⇒ Object
- #to_i ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(tms = nil) ⇒ Tms
tms
is a Benchmark::Tms object
189 190 191 192 193 194 195 196 |
# File 'lib/benelux.rb', line 189 def initialize tms=nil @samples = 0 members.each_with_index { |n, index| next if n.to_s == 'label' self.send("#{n}=", Stats::Calculator.new) } sample tms unless tms.nil? end |
Instance Attribute Details
#cstime ⇒ Object
Returns the value of attribute cstime
185 186 187 |
# File 'lib/benelux.rb', line 185 def cstime @cstime end |
#cutime ⇒ Object
Returns the value of attribute cutime
185 186 187 |
# File 'lib/benelux.rb', line 185 def cutime @cutime end |
#label ⇒ Object
Returns the value of attribute label
185 186 187 |
# File 'lib/benelux.rb', line 185 def label @label end |
#real ⇒ Object
Returns the value of attribute real
185 186 187 |
# File 'lib/benelux.rb', line 185 def real @real end |
#samples ⇒ Object (readonly)
TODO: integrate w/ github.com/copiousfreetime/hitimes
187 188 189 |
# File 'lib/benelux.rb', line 187 def samples @samples end |
#stime ⇒ Object
Returns the value of attribute stime
185 186 187 |
# File 'lib/benelux.rb', line 185 def stime @stime end |
#total ⇒ Object
Returns the value of attribute total
185 186 187 |
# File 'lib/benelux.rb', line 185 def total @total end |
#utime ⇒ Object
Returns the value of attribute utime
185 186 187 |
# File 'lib/benelux.rb', line 185 def utime @utime end |
Instance Method Details
#inspect ⇒ Object
214 215 216 217 218 219 220 221 |
# File 'lib/benelux.rb', line 214 def inspect fields = members.collect { |f| next unless Stats::Calculator === self.send(f) '%s=%.2f@%.2f' % [f, self.send(f).mean, self.send(f).sd] }.compact args = [self.class.to_s, self.hexoid, samples, fields.join(' ')] '#<%s:%s samples=%d %s>' % args end |
#sample(tms) ⇒ Object
197 198 199 200 201 202 203 204 |
# File 'lib/benelux.rb', line 197 def sample(tms) @samples += 1 self.label ||= tms.label members.each_with_index { |n, index| next if n.to_s == 'label' self.send(n).sample tms.send(n) || 0 } end |
#to_f ⇒ Object
205 206 207 |
# File 'lib/benelux.rb', line 205 def to_f total.mean.to_f end |
#to_i ⇒ Object
208 209 210 |
# File 'lib/benelux.rb', line 208 def to_i total.mean.to_i end |
#to_s ⇒ Object
211 212 213 |
# File 'lib/benelux.rb', line 211 def to_s total.mean.to_s end |