Measuring time taken to run a particular command in Linux

Sometimes, we may need to measure the time a particular command runs, for example, it may be when you want to know the time taken to compile your kernel, so you can stop worrying about it and work on the other stuff until that duration or you are testing something and want to know that the program is executing as per your time requirements.

'time' is the command line utility which you can achieve this

E.g. Let's see how much time it took for me to download the latest stable Linux release


real        2m25.720s
user       0m0.036s
sys         0m2.500s

It returns three values:

  • real: Total time taken by the command from start to end, as it was measured by human watch. Or you can say it as wall-clock time.
  • user: Amount of time CPU is in user-mode code.
  • sys: Amount of CPU time spent in kernel-mode . It means it is executing the system calls
Notice that sometimes user + sys might be greater than real, as multiple processors may work in parallel.

Comments

Popular posts from this blog

bb.utils.contains yocto

Difference between RDEPENDS and DEPENDS in Yocto

PR, PN and PV Variable in Yocto