Sunday, April 5, 2015

What do real-user-sys mean in the output of time(1)

[From http://man7.org/linux/man-pages/man1/time.1.html and http://man7.org/linux/man-pages/man2/times.2.html]
---------------------------------------------------------------------------
(i)   the elapsed real time between invocation and termination,
(ii)  the user CPU time (the sum of the tms_utime and tms_cutime values in a struct tms as returned by times(2))
(iii) the system CPU time (the sum of the tms_stime and tms_cstime values in a struct tms as returned by times(2)).

real  = Elapsed real (wall clock) time
user  = tms_utime + tms_cutime
sys   = tms_stime + tms_cstime

struct tms {
  clock_t tms_utime;  /* user time */
  clock_t tms_stime;  /* system time */
  clock_t tms_cutime; /* user time of children */
  clock_t tms_cstime; /* system time of children */
};
---------------------------------------------------------------------------

[From Ubuntu "$ man time"]
---------------------------------------------------------------------------
real %e
user %U
sys %S

The resource specifiers, which are a superset of those recognized by the tcsh(1) builtin `time' command, are:
%      A literal `%'.
E      Elapsed real (wall clock) time used by the process, in [hours:]minutes:seconds.
P      Percentage of the CPU that this job got.  This is just user + system times divided by the total running time. It also prints a percentage sign.
S      Total number of CPU-seconds used by the system on behalf of the process (in kernel mode), in seconds.
U      Total number of CPU-seconds that the process used directly (in user mode), in seconds.
e      Elapsed real (wall clock) time used by the process, in seconds.
---------------------------------------------------------------------------

References:
http://stackoverflow.com/questions/556405/what-do-real-user-and-sys-mean-in-the-output-of-time1
http://blog.he96.com/2011/01/linux-timewhat-do-real-user-and-sys.html
http://yuanfarn.blogspot.tw/2012/08/linux-time.html

No comments:

Post a Comment