I am trying to compare two tools execution time, which I have installed in my Debian Linux server. Now, I have to give two command line command to execute those two tools.
我试图比较我在Debian Linux服务器上安装的两个工具执行时间。现在,我必须给出两个命令行命令来执行这两个工具。
For example say,
比如说,
cat file1 file2 file3 > file4
and
cat file4 file5 file6 > file7
Now, I want to find execution time of 1st and 2nd command.
现在,我想找到第1和第2命令的执行时间。
Can anybody help me, how to find those two commands execution time? Programmatically foundation (say in Java) is also acceptable.
任何人都可以帮助我,如何找到这两个命令的执行时间?程序化基础(比如Java)也是可以接受的。
2 个解决方案
#1
1
Use the time
command
使用time命令
time cat file1 file2 file3 > file4
time
will write it's output to stderr
, so the redirection doesn't hurt.
time会将它的输出写入stderr,因此重定向不会受到影响。
#2
1
Have you tried the Linux time command ?
你试过Linux时间命令吗?
From the man
page:
从手册页:
The time command runs the specified program command with the given arguments. When command finishes, time writes a message to standard output giving timing statistics about this program run.
time命令使用给定的参数运行指定的程序命令。命令完成后,时间将消息写入标准输出,给出有关此程序运行的时序统计信息。
Note that shells often have a built-in time command as well, so this may cause confusion. If you want the command as opposed to the built-in (likely to be more fully featured), then the easiest way is to specify it via the full path.
请注意,shell通常也有内置时间命令,因此这可能会导致混淆。如果你想要命令而不是内置命令(可能更全功能),那么最简单的方法是通过完整路径指定它。
$ /usr/bin/time -o timing_info {my command}
(for example)
#1
1
Use the time
command
使用time命令
time cat file1 file2 file3 > file4
time
will write it's output to stderr
, so the redirection doesn't hurt.
time会将它的输出写入stderr,因此重定向不会受到影响。
#2
1
Have you tried the Linux time command ?
你试过Linux时间命令吗?
From the man
page:
从手册页:
The time command runs the specified program command with the given arguments. When command finishes, time writes a message to standard output giving timing statistics about this program run.
time命令使用给定的参数运行指定的程序命令。命令完成后,时间将消息写入标准输出,给出有关此程序运行的时序统计信息。
Note that shells often have a built-in time command as well, so this may cause confusion. If you want the command as opposed to the built-in (likely to be more fully featured), then the easiest way is to specify it via the full path.
请注意,shell通常也有内置时间命令,因此这可能会导致混淆。如果你想要命令而不是内置命令(可能更全功能),那么最简单的方法是通过完整路径指定它。
$ /usr/bin/time -o timing_info {my command}
(for example)