What specifically are wall-clock-time, user-cpu-time, and system-cpu-time in UNIX?

John Humphreys - w00te picture John Humphreys - w00te · Sep 7, 2011 · Viewed 75.1k times · Source

I can take a guess based on the names, but what specifically are wall-clock-time, user-cpu-time, and system-cpu-time in UNIX?

Is user-cpu time the amount of time spent executing user-code while kernel-cpu time the amount of time spent in the kernel due to the need of privileged operations (like IO to disk)?

What unit of time is this measurement in.

And is wall-clock time really the number of seconds the process has spent on the CPU or is the name just misleading?

Answer

Jonathan Leffler picture Jonathan Leffler · Sep 7, 2011

Wall-clock time is the time that a clock on the wall (or a stopwatch in hand) would measure as having elapsed between the start of the process and 'now'.

The user-cpu time and system-cpu time are pretty much as you said - the amount of time spent in user code and the amount of time spent in kernel code.

The units are seconds (and subseconds, which might be microseconds or nanoseconds).

The wall-clock time is not the number of seconds that the process has spent on the CPU; it is the elapsed time, including time spent waiting for its turn on the CPU (while other processes get to run).