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

procedure task_to_measure()
    sleep(0.1)
end procedure
 
printf(1,"method 1: calculate reciprocal of elapsed time:\n")
for trial=1 to 3 do
    atom t=time()
    task_to_measure()
    t = time()-t
    string r = iff(t?sprintf("%g",1/t):"inf")
    printf(1,"rate = %s per second\n",{r})
end for
 
printf(1,"method 2: count completed tasks in one second:\n")
for trial=1 to 3 do
    integer runs=0
    atom finish=time()+1
    while true do
        task_to_measure()
        if time()>=finish then exit end if
        runs += 1
    end while
    printf(1,"rate = %d per second\n",runs)
end for
