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
183 184 185 186 187 188 189 190 |
# File 'lib/benelux.rb', line 183 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
179 180 181 |
# File 'lib/benelux.rb', line 179 def cstime @cstime end |
#cutime ⇒ Object
Returns the value of attribute cutime
179 180 181 |
# File 'lib/benelux.rb', line 179 def cutime @cutime end |
#label ⇒ Object
Returns the value of attribute label
179 180 181 |
# File 'lib/benelux.rb', line 179 def label @label end |
#real ⇒ Object
Returns the value of attribute real
179 180 181 |
# File 'lib/benelux.rb', line 179 def real @real end |
#samples ⇒ Object (readonly)
TODO: integrate w/ github.com/copiousfreetime/hitimes
181 182 183 |
# File 'lib/benelux.rb', line 181 def samples @samples end |
#stime ⇒ Object
Returns the value of attribute stime
179 180 181 |
# File 'lib/benelux.rb', line 179 def stime @stime end |
#total ⇒ Object
Returns the value of attribute total
179 180 181 |
# File 'lib/benelux.rb', line 179 def total @total end |
#utime ⇒ Object
Returns the value of attribute utime
179 180 181 |
# File 'lib/benelux.rb', line 179 def utime @utime end |
Instance Method Details
#inspect ⇒ Object
208 209 210 211 212 213 214 215 |
# File 'lib/benelux.rb', line 208 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
191 192 193 194 195 196 197 198 |
# File 'lib/benelux.rb', line 191 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
199 200 201 |
# File 'lib/benelux.rb', line 199 def to_f total.mean.to_f end |
#to_i ⇒ Object
202 203 204 |
# File 'lib/benelux.rb', line 202 def to_i total.mean.to_i end |
#to_s ⇒ Object
205 206 207 |
# File 'lib/benelux.rb', line 205 def to_s total.mean.to_s end |