In Files

Parent

Benelux::Tms

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

Attributes

samples[R]

Public Class Methods

new(tms=nil) click to toggle source

tms is a Benchmark::Tms object

# 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

Public Instance Methods

inspect() click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# File lib/benelux.rb, line 199
def to_f
  total.mean.to_f
end
to_i() click to toggle source
# File lib/benelux.rb, line 202
def to_i
  total.mean.to_i
end
to_s() click to toggle source
# File lib/benelux.rb, line 205
def to_s
  total.mean.to_s
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.