up previous next
CpuTime

Counts cpu time

Syntax
CpuTime(): RAT

Description
This function returns a RAT whose value is the user CPU usage in seconds since the start of the program: this is the amount of time the processor has dedicated to your computation, and may be rather less than the real elapsed time if the computer is also busy with other tasks.

The most common usage is with TimeFrom as shown in the example.

Example
/**/ StartTime := CpuTime(); -- time in seconds since the start (a RAT)
/**/ --
/**/ -- .... long computation ....
/**/ --
/**/ PrintLn "Computation time: ", TimeFrom(StartTime);
You can use DecimalStr to see the value of CpuTime in a more easily comprehensible form.
See Also