Chapter 9. $fh.stats

Utilise temporary stats counters and timers, which can then be viewed as graphs in the Studio.

9.1. Example

// Increment a counter.
// The name for the counter you want to increment.
// If this doesn't exist, it is created, and starts at 0.
var counter = 'my_counter';

// Decrement a counter

// Record a timer value
// The name for the timer you want to record a value for.
// If it doesn't exist, it is created.
var timer_name = 'my_timer';
// Timing in milliseconds of the interval you wish to record
// (for example, time difference between a timer start and end)
var time_in_ms = 500;
$fh.stats.timing(timer_name, time_in_ms);