danielcrenna/metrics-net — pull request #9 by pieterbreed (2012-08-20 09:06:00+00:00)
Title: Adding support for a manual recording of a timer where the measurement comes from outside the metrics library

Manual timers are used when the client system does not need any help actually doing the measurement but would like the metrics system to add take the measurement into account (for logging, histograms and so on).

var timer = Metrics.ManualTimer(typeof(TimerTests), "test", TimeUnit.Milliseconds, TimeUnit.Milliseconds);

for (int i = 0; i < 10; i++)
{
timer.RecordElapsedMillis(250);
}

Assert.AreEqual(250d, timer.Mean, 5);
Assert.AreEqual(1d, timer.StdDev, 1);