Measure Time With Gnu Time

Using GNU Time vs. shell builtin

GNU Time

b96123@linux13 [~/workspace/sysprog/hw1] /usr/bin/time sysprog_hw1 testdata/knuth_words-shuffled.txt >hw1output.out
0.31user 0.02system 0:00.68elapsed 49%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+2136outputs (0major+7493minor)pagefaults 0swaps
 
b96123@linux13 [~/workspace/sysprog/hw1] /usr/bin/time -p sysprog_hw1 testdata/knuth_words-shuffled.txt >hw1output.out
real 0.68
user 0.32
sys 0.01

GNU Time with custom format options

b96123@linux13 [~/workspace/sysprog/hw1] /usr/bin/time -f "%Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k%Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps" sysprog_hw1 testdata/knuth_words-shuffled.txt >hw1output.out
0.30user 0.02system 0:00.72elapsed 46%CPU (0text+0data 0max)k0inputs+2136outputs (0major+7493minor)pagefaults 0swaps
b96123@linux13 [~/workspace/sysprog/hw1]

bash shell builtin

b96123@linux13 [~/workspace/sysprog/hw1] time sysprog_hw1 testdata/knuth_words-shuffled.txt >hw1output.out
 
real    0m0.694s
user    0m0.324s
sys     0m0.016s
b96123@linux13 [~/workspace/sysprog/hw1]
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License