Saturday, March 28th, 2009 | Author:

Its amazing how much you can do by combining the small yet powerful commands Unix has available.

This little-used command, time, finally became useful today as a way to report the length of time that certain automated operations are running. In my example, I’m timing how long it takes to build the Linux kernel:

$ time rebuild-kernel26
...
couple-thousand-lines-of-scrolling-text
...
==> Finished making: kernel26 2.6.28.8-1 x86_64 (Sat Mar 28 17:19:52 SAST 2009)
real    62m21.994s
user    43m31.846s
sys     6m1.096s

Yup, that took a little over an hour to build. The values are:

  • realthe actual time elapsed while the command was running – 62 minutes
  • userthe amount of userland time the command used – 43 minutes
  • systhe amount of system time the command used – 6 minutes

(I was busy doing other things while this was happening which is why it took 62 minutes for the desktop to do (43+6=) 49 minutes-worth of work)

If you’re using the GNU version (most likely), it also gives you the option of displaying the results in a custom fashion. Mostly, this command could be useful in scripts where you need to report how long a task tookor maybe? just a geeky way to time something random. 😛

Deel
Kategorie: linux
Jy kan al die antwoorde op hierdie inskrywing deur die RSS 2.0 voer. Jy kan laat 'n antwoord, of trackback vanaf jou eie webwerf.
Laat 'n antwoord » Teken in