From the course: Linux Performance Tuning

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Timing techniques

Timing techniques - Linux Tutorial

From the course: Linux Performance Tuning

Start my 1-month free trial

Timing techniques

- [Narrator] A really understandable way to do timing is just to find out how long something took in the real world, and if it takes a long time then you could use the date command, and then you run it, and when it finishes three days later you check the date again. You realize, hey, three days in between. That's not too common. Generally you're more interested in time and one thing you can do with Bash is have the shell prompt include the time. So then you can just look at the two shell prompts and see the difference. And we have the time command. The time command might be at user bin time or maybe just bin time and this is a prefix command. So you use the time command to run another command. We'll use the time command to run the sleep command and we tell sleep to sleep for two seconds and after two seconds when that's done time prints out the elapsed time, and we have time use in the CPU in user space and in the kernel which are both zero 'cause the sleep command uses so little CPU…

Contents