bench (version 1.0.1)

system_time: Return Process CPU and real time that an expression used.

Description

Return Process CPU and real time that an expression used.

Usage

system_time(expr)

Arguments

expr

A expression to be timed.

Value

A bench_time object with two values.

  • process - The process CPU usage of the expression evaluation.

  • real - The wallclock time of the expression evaluation.

Details

On some systems (such as macOS) the process clock has lower precision than the realtime clock, as a result there may be cases where the process time is larger than the real time for fast expressions.

Examples

Run this code
# NOT RUN {
# This will use ~.5 seconds of real time, but very little process time.
system_time(Sys.sleep(.5))
# }

Run the code above in your browser using DataCamp Workspace