Home > Linux > Tip of the day > Time a task: time

Time a task: time

Saturday 23 June 2007, by Nadir SOUALEM

All the versions of this article: [English] [français]

It proves sometimes useful to know the execution time of a task. The time command makes it possible to determine the duration of a process, it uses the clock system, so it depends on your processor and on its request: in other words, if you watch a movie and you compile a C++ program, the time compilation will last longer that if you compile it without watching the movie.

To time a task, we use the time command plus the task. Here, we want to list (ls -al) the whole current directory recursively(R), i.e. we also consider subdirectories.

- real corresponds to the real time of the task. .
- user corresponds to the user time, i.e. the CPU time used by the user’s program
- sys defines time system, that corresponds to the time used by the system to manage the execution of the task.

Consequently, we easily determine time CPU of the task, I recall you that time CPU is defines as follows: CPU = user time + sys time.
Then do not waste time, and test this command!

Any message or comments?

pre-moderation

This forum is moderated before publication: your contribution will only appear after being validated by an administrator.

Who are you?
Your post
  • To create paragraphs, just leave blank lines.

If you want to help Math-Linux.com project , Send your contributions to our team. Thanks !!!

Links