class Stopwatch
Definitions
attr :samples
The individual samples' durations.
attr :concurrency
The maximum number of executing measurements at any one time.
def variance
Computes Population Variance, σ^2.
Implementation
def variance
if valid?
average = self.average
return @samples.map{|n| (n - average)**2}.sum / @samples.size
end
end
def standard_deviation
Population Standard Deviation, σ
Implementation
def standard_deviation
if variance = self.variance
Math.sqrt(variance.abs)
end
end