gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 07:58:00 26 4
gpt4 key购买 nike

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

以下是我得到的:

time ./filereader 

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

什么是 real , user , sys ?

最佳答案

发件人: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.

关于unix - 如何理解时间命令的输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3432085/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com