加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-15 19:43:23 所属栏目:安全 来源:网络整理
导读:我试图弄清楚我的代码的性能,但我不明白时间命令的输出,任何人都可以解释什么是时间命令输出的意思。 以下是我得到的: time ./filereader real 0m0.193suser 0m0.012ssys 0m0.056s 什么是真实的,用户的,系统的? From: http://zch051383471952.blogspo
我试图弄清楚我的代码的性能,但我不明白时间命令的输出,任何人都可以解释什么是时间命令输出的意思。

以下是我得到的:

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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读