Of interest is the code that performs the actual measurements. Any other code (such as job implementation or dispatching) that is required to demonstrate the rate tracking is helpful, but not the focus.

Multiple approaches are allowed (even preferable), so long as they can accomplish these goals:

 Run N seconds worth of jobs and/or Y jobs.
 Report at least three distinct times.

Be aware of the precision and accuracy limitations of your timing mechanisms, and document them if you can.

See also: System time, Time a function

#!/usr/bin/env jsish
"use strict";
/* Rate counter, timer access, in Jsish */
 
/* System time in milliseconds */
var runs = 0, newMs;
function countJobsIsTheJob() { runs += 1; }
var milliSeconds = strptime();
while ((newMs = strptime()) < (milliSeconds + 1000)) { countJobsIsTheJob(); }
puts(runs, 'runs in', newMs - milliSeconds, 'ms');
 
 
/* Builtin times test(callback, runs), result in microseconds */
function sleeper() { sleep(10); }
 
var timer;
for (var i = 1; i < 4; i++) {
    timer = times(sleeper, 100);
    puts(timer, 'μs to sleep 10 ms, 100 times');
}