The problem is when I use time in shell I get output like that:
1.350u 0.038s 0:01.45 95.1% 0+0k 0+72io 1pf+0w
And when Im using it in script I get:
real 0m1.253s
user 0m1.143s
sys 0m0.047s
I mean why? And 开发者_运维知识库in shell script at the beginning I write:
#!/bin/bash
Bash has a built-in command time
, and your system should also have a separate binary at /usr/bin/time
:
$ help time time: time [-p] pipeline Report time consumed by pipeline's execution. Execute PIPELINE and print a summary of the real time, user CPU time, ... $ which time /usr/bin/time
The two commands produce different outputs:
$ time echo hi hi real 0m0.000s user 0m0.000s sys 0m0.000s $ /usr/bin/time echo hi hi 0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+199minor)pagefaults 0swaps
精彩评论