![如何确定进程的挂钟时间?](https://linux22.com/image/32981/%E5%A6%82%E4%BD%95%E7%A1%AE%E5%AE%9A%E8%BF%9B%E7%A8%8B%E7%9A%84%E6%8C%82%E9%92%9F%E6%97%B6%E9%97%B4%EF%BC%9F.png)
我找到了一般的Linux程序time
,其中有一个命令。例如,假设我想计算foo
.我可以用:
time foo
给出以下示例输出:
real 0m8.738s
user 0m5.796s
sys 0m0.576s
然而,手册页time
似乎有点不清楚(尽管我是Linux新手):
TIME(1) Linux User's Manual TIME(1) NAME time - time a simple command or give resource usage SYNOPSIS time [options] command [arguments...] DESCRIPTION The time command runs the specified program command with the given arguments. When command finishes, time writes a message to standard error giving timing statistics about this program run. These statis- tics consist of (i) the elapsed real time between invocation and termi- nation, (ii) the user CPU time (the sum of the tms_utime and tms_cutime values in a struct tms as returned by times(2)), and (iii) the system CPU time (the sum of the tms_stime and tms_cstime values in a struct tms as returned by times(2)).
“真实”时间是指挂钟时间?
答案1
“实际”时间是经过的时间,通常是挂钟时间之间的差异,但并非总是如此。
例如,如果在时间更改为 02:00 的区域设置中夏令时生效当天的 01:59:00 启动进程,并且该进程需要两分钟,则实际经过的时间将是两分钟,而挂钟将显示一小时零两分钟的差异。 (当时间偏移变回时,挂钟差将为负,但实际经过的时间将继续相同。)