Chicken » Module (chicken time)

## Module (chicken time)

This module provides a few basic procedures for measuring time. For representation and manipulation of calendar time, see Module (chicken time posix).

### Retrieving timestamp information

#### cpu-time

cpu-timeprocedure

  Returns the used CPU time of the current process in milliseconds as two values: the time spent in user code, and the time spent in system code. On platforms where user and system time can not be differentiated, system time is always 0.

#### current-process-milliseconds

current-process-millisecondsprocedure

  Returns the number of milliseconds since process startup.

#### current-seconds

current-secondsprocedure

  Returns the number of seconds since midnight, Jan. 1, 1970.

### Benchmarking macros

#### time

`(time EXP1 ...)`syntax

  Performs a major garbage collection, evaluates `EXP1 ...` and prints elapsed CPU time and some values about GC use, like time spent in major GCs, number of minor and major GCs. The output is sent to the port that is the current value of `(current-error-port)`. Nested invocations of this form will give incorrect results for all output but the innermost.

Previous: Module (chicken tcp)

Next: Module (chicken time posix)