当我在 Ubuntu 10.4 上对一个程序进行计时时,我得到如下输出:
real 0m14.581s
user 0m14.570s
sys 0m0.010s
这些不同的类别代表什么含义?
答案1
man time
会给你答案:
Real time and process time
Real time is defined as time measured from some fixed point, either
from a standard point in the past (see the description of the Epoch and
calendar time below), or from some point (e.g., the start) in the life
of a process (elapsed time).
Process time is defined as the amount of CPU time used by a process.
This is sometimes divided into user and system components. User CPU
time is the time spent executing code in user mode. System CPU time is
the time spent by the kernel executing in system mode on behalf of the
process (e.g., executing system calls). The time(1) command can be
used to determine the amount of CPU time consumed during the execution
of a program. A program can determine the amount of CPU time it has
consumed using times(2), getrusage(2), or clock(3).