Wednesday, March 20, 2013

time command in Linux

When working on cs252 lab, I was confused by the meaning of the output of time command. By searching the web, something useful was found.

http://www.dirac.org/linux/time/

To summarize,

Real is wall clock time - time from start to finish of the call. This is all elapsed time including time slices used by other processed and time the process spends blocked (for example if it is waiting for I/O to complete).

User is the amount of CPU time spent in user-mode code (outside the kernel) within the process. This is only actual CPU time used in executing the process. Other processes and time the process spends blocked do not count towards this figure.

Sys is the amount of CPU time spent in the kernel within the process. This means executing CPU time spent in system calls within the kernel, as opposed to library code, which is still running in user-space. Like 'user', this is only CUP time used by the process.

The equation is
user + Sys will tell you how much actual CPU time your process used.

No comments:

Post a Comment