next up previous contents
Next: Spell checking Up: Other useful commands Previous: Finding the differences between   Contents

Time a command or a program

The command time <command> times a <command>, where the <command> can be a program or a Linux command. However, there are more precise ways of measuring the execution time for parts of a program, which you will learn about in various classes.

For example:

[amit@dslamit cs253]$ time sleep 4

real    0m4.020s
user    0m0.000s
sys     0m0.000s
[amit@dslamit cs253]$

Here sleep is a command that just sleeps for the given number of seconds. The command time gives the ``real'' (elapsed) time followed by time spent by the CPU in user mode as well in system mode. Due to programs potentially sleeping and due to multiple users on a system the user plus system time is usually less than the real time reported by the time command.



Amit Jain 2009-08-23