Class Benelux::Tms

  1. lib/benelux.rb
Parent: Struct.new :label, :real, :cstime, :cutime, :stime, :utime, :total

Similar to Benchmark::Tms with the addition of standard deviation, mean, and total, for each of the data times.

tms = Benelux::Tms.new
tms.real.sd       # standard deviation
tms.utime.mean    # mean value
tms.total.n       # number of data points

See Benelux::Stats::Calculator

Methods

public class

  1. new

public instance

  1. inspect
  2. sample
  3. to_f
  4. to_i
  5. to_s

Attributes

samples [R]

Public class methods

new (tms=nil)

tms is a Benchmark::Tms object

[show source]
     # File lib/benelux.rb, line 183
183:     def initialize tms=nil
184:       @samples = 0
185:       members.each_with_index { |n, index| 
186:         next if n.to_s == 'label'
187:         self.send("#{n}=", Stats::Calculator.new)
188:       }
189:       sample tms unless tms.nil?
190:     end

Public instance methods

inspect ()
[show source]
     # File lib/benelux.rb, line 208
208:     def inspect
209:       fields = members.collect { |f| 
210:         next unless Stats::Calculator === self.send(f)
211:         '%s=%.2f@%.2f' % [f, self.send(f).mean, self.send(f).sd] 
212:       }.compact
213:       args = [self.class.to_s, self.hexoid, samples, fields.join(' ')]
214:       '#<%s:%s samples=%d %s>' % args
215:     end
sample (tms)
[show source]
     # File lib/benelux.rb, line 191
191:     def sample(tms)
192:       @samples += 1
193:       self.label ||= tms.label
194:       members.each_with_index { |n, index| 
195:         next if n.to_s == 'label'
196:         self.send(n).sample tms.send(n) || 0
197:       }
198:     end
to_f ()
[show source]
     # File lib/benelux.rb, line 199
199:     def to_f
200:       total.mean.to_f
201:     end
to_i ()
[show source]
     # File lib/benelux.rb, line 202
202:     def to_i
203:       total.mean.to_i
204:     end
to_s ()
[show source]
     # File lib/benelux.rb, line 205
205:     def to_s
206:       total.mean.to_s
207:     end