[英]Changing the Resolution of “time” Command in Linux
Is there any way to change the resolution (accuracy) of the reported execution time by "time" command in Linux? 在Linux中,是否可以通过“时间”命令更改报告执行时间的分辨率(精度)? It already reports the execution time in milli seconds. 它已经报告了执行时间(以毫秒为单位)。
Thanks 谢谢
Looks to me like 3 digits after the zero is the maximum resolution. 在我看来,零分辨率是最高分辨率后的3位数字。 If you want better resolution, I would suggest you write a wrapper in C and use utime
See man -s2 utime
如果您想获得更好的分辨率,我建议您使用C语言编写一个包装器并使用utime
参见man -s2 utime
If you are using bash, then the output format of the time command (a builtin function) can be set using the TIMEFORMAT
environment variable. 如果使用的是bash,则可以使用TIMEFORMAT
环境变量设置time命令(内置函数)的输出格式。 See man bash
and search for TIMEFORMAT
查看man bash
并搜索TIMEFORMAT
If you are using the gnu time utility, you can set the format using time --format=
check man time
. 如果使用的是gnu time实用程序,则可以使用time --format=
check man time
来设置格式。 In both cases, I don't see an option for higher resolution. 在这两种情况下,我都看不到更高分辨率的选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.