Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When using the time command to measure time of different executions of a process (under different hardware circumstances), I came across a phenomenon that I don't understand.

The real time of the 1st execution was 77 minutes and 82 minutes for the 2nd execution. However, the user time was 6 minutes faster in the 2nd execution and similarly for the sys time the 2nd execution was 1 minute faster.

How can the real time still be better for the 1st execution?
And when comparing execution times, which one of the 3 times is a good indicator for the general execution time of a process? (I have processes that prints out a lot of info and processes that don't print out anything, if that makes any difference)

share|improve this question

1 Answer 1

up vote 1 down vote accepted

If I remember correctly:

  • real time represents clock time: it is amount of time that process takes to run. This time depends on number of processes being run on the system, so this may explain why is real time better in first execution.
  • user time represents the amount of CPU time attributed to user instructions. (user-mode, outside of kernel)
  • sys time is amount of time that CPU spends in kernel within running process. For example, whenever you use read or write methods, time spent within kernel performing this 'services' is charged to this time.

So, when comparing general execution times, you could use user time + sys time.

Hope this helps.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.