Class RFuzz::Sampler
In: lib/rfuzz/stats.rb
Parent: Object

Methods

dump   keys   mark   mean   new   reset   sample   sd   tick   to_hash   to_s   values  

Attributes

max  [R] 
min  [R] 
n  [R] 
sum  [R] 
sumsq  [R] 

Public Class methods

Class method that returns the headers that a CSV file would have for the values that this stats object is using.

Public Instance methods

Dump this Sampler object with an optional additional message.

You can just call tick repeatedly if you need the delta times between a set of sample periods, but many times you actually want to sample how long something takes between a start/end period. Call mark at the beginning and then tick at the end you’ll get this kind of measurement. Don‘t mix mark/tick and tick sampling together or the measurement will be meaningless.

Calculates and returns the mean for the data passed so far.

Resets the internal counters so you can start sampling again.

Adds a sampling to the calculations.

Calculates the standard deviation of the data so far.

Adds a time delta between now and the last time you called this. This will give you the average time between two activities.

An example is:

 t = Sampler.new("do_stuff")
 10000.times { do_stuff(); t.tick }
 t.dump("time")

Returns a common display (used by dump)

An array of the values minus the name: [sum,sumsq,n,mean,sd,min,max]

[Validate]