How do I interpret the output of the "time" command?

14,326

From the manpage:

The default format is:

    %Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k
    %Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps

So, 106 seconds spent in userspace, 0 seconds in kernelspace, 1 minute and 46 seconds elapsed "real" time.

As for "why is the first value so small" - it isn't. Note that 106 seconds == 60 seconds + 46 seconds == 1 minute 46 seconds, which is the time elapsed. I don't see a discrepancy there.

Share:
14,326
f-z-N
Author by

f-z-N

Updated on September 18, 2022

Comments

  • f-z-N
    f-z-N almost 2 years
     time a.out 
     106.130u 0.000s 1:46.28 99.8%   0+0k 0+0io 83pf+0w
    

    As per my understanding of the man page:

    • the first value is the time since the code execution started and ended,
    • the second values is the time spent in usermode
    • the third one being in kernel mode

    Is the 99.8% indicating time spent in kernel mode?

    Also, what does this indicate?

    0+0k 0+0io 83pf+0w .
    

    The program definitely takes more than a minute to execute – then why is the first value so small?

  • f-z-N
    f-z-N almost 13 years
    Thank you.. i was getting confused seeing the first u with the first value thinking it was microsecond. Really dumb
  • Loduwijk
    Loduwijk over 7 years
    @f-z-N I was thinking the same thing. There was nothing to indicate that it is seconds, and the next field does have an 's' suffix, so it is reasonable (in fact, should be expected) to be microseconds and seconds. Even after seeing Piskvor's "The default format is", it still didn't sink in immediately that u is for user and s is for system. In measurement, especially with time, u=micro and s=seconds is so deeply embedded into us that these suffixes really should not be used this way.