time method

void time (
  1. String name,
  2. Stopwatch stopwatch,
  3. [double sampleRate]

Adds timing metric value to this batch.

Value of stopwatch.elapsedMilliseconds will be used.

The sampleRate parameter if provided tells statsd that this counter is being sampled. For instance, value 0.1 means that the counter is sampled every 1/10th of the time.


void time(String name, Stopwatch stopwatch, [double sampleRate]) {
  var msec = stopwatch.elapsedMilliseconds.toString();
  _packets.add(_packet(_prefix, name, msec, 'ms', sampleRate));