Im using time to time a Perl script on standard terminal in Ubuntu 14.04.

I have read that real time is stopwatch time; the time I, as a user, is spending looking at the program running from I start the program until it terminates. But I don't get what user or sys times are. The man page on time is vague, to say the least.

While it is somewhat clear that the real time is split between user and sys it is not clear what they represent.

In my script I'm benchmarking[1] C++ and Perl against each other to see the difference, and I would like to know what data I'm actually getting. An example output is:

real    0m24.198s
user    0m23.120s
sys     0m1.030s

Could someone please elaborate what the default format of time is telling the user? I'm a novice into Linux, so please don't assume too much.

[1] Interestingly, while C++ is way, way faster than Perl in my benchmark with regards to real time, the sys times doesn't differ that much, with C++ actually using more sys time than Perl. This is why I want to know what they mean


1 Answer 1


From wikipedia:

  • User Time vs System Time

The term 'user CPU time' can be a bit misleading at first. To be clear, the total CPU time is the combination of the amount of time the CPU(s) spent performing some action for a program and the amount of time the CPU(s) spent performing system calls for the kernel on the program's behalf. When a program loops through an array, it is accumulating user CPU time. Conversely, when a program executes a system call such as exec or fork, it is accumulating system CPU time.

  • Real Time vs CPU Time

The term "real time" in this context refers to elapsed "wall clock" time, like using a stop watch. The total CPU time (user time + sys time) may be more or less than that value. Because a program may spend some time waiting and not executing at all (whether in user mode or system mode) the real time may be greater than the total CPU time. Because a program may fork children whose CPU times (both user and sys) are added to the values reported by the time command, the total CPU time may be greater than the real time.

  • 1
    I don't understand how I managed to not find that Wikipedia article. Thank you.
    – Alrekr
    Commented May 25, 2014 at 7:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .