简体   繁体   English

如何显示终端的运行时间?

[英]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.

相关问题 如何查看终端的运行时间? (Ubuntu用户) - How can I see the running time of the terminal? (Ubuntu user) 如何设置终端标题以显示正在运行的当前运行命令,并在完成后将其显示在括号中? - How to set the terminal title to show the current running command while it's running and to show it in brackets once it's finished? 如何在终端/控制台的命令行旁边显示时间 - How to show time next to the command line in terminal/console 如何获取启动时间并通过Linux中的内核编程在终端上显示启动时间? - How to get boot time and show it on terminal wtih kernel programming in Linux? 如何让g ++显示终端的执行时间? - How to make g++ to show the execution time in terminal? 每次打开终端时显示问候语 Linux - Show greeting each time opening Terminal Linux 如何在终端中输入正在运行的进程 - How to input on a running process in a terminal 如何在Linux应用程序中显示终端? - How to show terminal in linux application? 当我在ubuntu的mongo终端中运行show dbs时,命令没有运行 - command not running when i run show dbs in mongo terminal in ubuntu 如何使在一个终端中运行的程序的输出成为另一终端的输入? - How to make the output of program running in one terminal be the input of another terminal?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM