Linux中有两个time命令,一个bash的内置time,一个GNU time。
[root@wingwu ~]# type -a time
time is a shell keyword
time is /usr/bin/time
|
bash time 很简单,它只是显示程序的执行时间,没什么可用的参数。
[root@wingwu ~]# time date
2010年 04月 26日 星期一 20:49:05 CST
real 0m0.009s
user 0m0.001s
sys 0m0.003s
|
GNU time 除了显示程序的执行时间,同时也会显示很多其它信息:内存、I/O和IPC Call等信息。
[root@wingwu ~]# /usr/bin/time -v date
2010年 04月 26日 星期一 20:50:29 CST
Command being timed: "date"
User time (seconds): 0.00
System time (seconds): 0.00
Percent of CPU this job got: 0%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.00
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 0
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 202
Voluntary context switches: 1
Involuntary context switches: 2
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
|
通过man time可用查看到这两个命令的相关信息。
阅读(973) | 评论(0) | 转发(0) |