unix – 如何理解时间命令的输出?

我试图弄清楚我的代码的性能,但我不明白时间命令的输出,任何人都可以解释什么是时间命令输出的意思。

以下是我得到的:

time ./filereader 

real    0m0.193s
user    0m0.012s
sys 0m0.056s

什么是真实的,用户的,系统的?

From: http://zch051383471952.blogspot.com/2010/01/different-of-real-user-sys-time.html

Real refers to actual elapsed time;
User and Sys refer to CPU time used
only by the process.

  • Real is wall clock time – time from start to finish of the call. This is
    all elapsed time including time slices
    used by other processes 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 CPU time used by the process.

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...