如何理解时间命令的输出? [英] How to understand the output of time command?

查看:21
本文介绍了如何理解时间命令的输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想弄清楚我的代码的性能,但我不明白 time 命令的输出,谁能解释一下 time 命令输出是什么意思.

I am trying to figure out the performance of my code, but I do not understand the output of the time command, Can anybody please explain what does time command output means.

以下是我得到的:

time ./filereader 

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

什么是realusersys?

推荐答案

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

Real 是指实际经过的时间;User 和 Sys 是指使用的 CPU 时间只看过程.

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

  • Real 是挂钟时间 - 从通话开始到结束的时间.这是所有经过的时间,包括时间片被其他进程使用并计时进程花费被阻塞(例如,如果它正在等待 I/O 完成).
  • User 是在用户模式代码中花费的 CPU 时间(在内核)在进程中.这是仅用于执行的实际 CPU 时间过程.其他流程和时间进程花费阻塞不计入这个数字.
  • Sys 是进程内内核花费的 CPU 时间量.这个表示执行 CPU 时间花费在内核中的系统调用,如与库代码相反,这是仍在用户空间中运行.喜欢'user',这只是被使用的 CPU 时间过程.

这篇关于如何理解时间命令的输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆