实时调度

时间:2014-12-08 11:08:02

标签: linux

我试图测量我通过命令行调用的进程的执行时间(即,我想知道进程完成所需的时间)。有没有算法来计算它?

1 个答案:

答案 0 :(得分:1)

使用内置时间命令:

例如:

#time tail /var/log/messages

Messages...
Messages...

real    0m0.016s
user    0m0.000s
sys     0m0.004s

有关更具体和详细信息,请使用:

#/usr/bin/time -v sleep 1
       Command being timed: "sleep 1"
       User time (seconds): 0.00
       System time (seconds): 0.00
       Percent of CPU this job got: 1%
       Elapsed (wall clock) time (h:mm:ss or m:ss): 0:01.05
       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: 210
       Voluntary context switches: 2
       Involuntary context switches: 1
       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