[英]How to show running time in terminal?
I am using Python for a while and I learned that by some method like timeit() I can estimate the running time of my programe. 我使用Python已有一段时间,并且了解到可以通过timeit()之类的方法估算程序的运行时间。
But, is it any way that when my programe finished in the terminal, it also print out the running time?! 但是,当我的程序在终端中完成时,它还能打印出运行时间吗?! (any terminal command do that?!) (任何终端命令都可以吗?!)
Use the following: 使用以下内容:
$ time your_programm $时间your_programm
the output is: 输出为:
$ time sleep 1 $时间睡眠1
real 0m1.002s 真正的0m1.002s
user 0m0.000s 用户0m0.000s
sys 0m0.000s sys 0m0.000s
showing how much time was spent in kernel and user space and the total time spent. 显示在内核和用户空间上花费了多少时间,以及所花费的总时间。
time
命令正是这样做的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.