Class | Mongrel::Stats
In: | lib/mongrel/stats.rb
Parent: | Object

### Methods

dump mean new reset sample sd tick to_s

### Attributes

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

### Public Class methods

new(name)

### Public Instance methods

dump(msg = "", out=STDERR)

Dump this Stats object with an optional additional message.

mean()

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

reset()

Resets the internal counters so you can start sampling again.

sample(s)

Adds a sampling to the calculations.

sd()

Calculates the standard deviation of the data so far.

tick()

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 = Stats.new("do_stuff")
     10000.times { do_stuff(); t.tick }
     t.dump("time")

to_s()

Returns a common display (used by dump)

[Validate]