unixoperating-systemcpu-timewall-time

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


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 I/O 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?


Solution

  • 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).