← index

Timerabstract

inherits Object

A one-selector stopwatch: run a block, get its elapsed time.

For finer control (start now, read later, compare points), use Instant and Duration directly.

Class methods

time:

Run the block and answer how long it took, in whole microseconds (an Integer). Measured on the monotonic clock, so wall-clock adjustments cannot skew it.

Timer.time:{ (1..1000).each:{ |i| i } }     "* the elapsed microseconds

native