在线时间:8:00-16:00
132-9538-2358
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
我正在使用Python一段时间,我通过某些方法(如timeit())了解到我可以估计我的程序的运行时间。 但是,当我的程序在终端完成时,它是否打印出运行时间? (任何终端命令都这样做?!) 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. 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?!)原文:https://stackoverflow.com/questions/7566492
我正在使用Python一段时间,我通过某些方法(如timeit())了解到我可以估计我的程序的运行时间。
但是,当我的程序在终端完成时,它是否打印出运行时间? (任何终端命令都这样做?!)
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.
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?!)
使用以下内容: $ time your_programm 输出是: $ time sleep 1 真正的0m1.002s 用户0m0.000s sys 0m0.000s 显示在内核和用户空间中花费了多少时间以及花费的总时间。 Use the following: $ time your_programm the output is: $ time sleep 1 real 0m1.002s user 0m0.000s sys 0m0.000s showing how much time was spent in kernel and user space and the total time spent.
使用以下内容:
$ time your_programm
输出是:
$ time sleep 1 真正的0m1.002s 用户0m0.000s sys 0m0.000s
$ time sleep 1
真正的0m1.002s
用户0m0.000s
sys 0m0.000s
显示在内核和用户空间中花费了多少时间以及花费的总时间。
Use the following:
the output is:
$ time sleep 1 real 0m1.002s user 0m0.000s sys 0m0.000s
real 0m1.002s
user 0m0.000s
showing how much time was spent in kernel and user space and the total time spent.
评论
请发表评论