LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-26-2006, 08:53 AM   #1
caprianking2002
LQ Newbie
 
Registered: Sep 2005
Posts: 1

Rep: Reputation: 0
commnad time execution


Hi,
I have query regarding different time taken during command execution.
For example if i execute ls command on the shell like this:

time ls -alh

the output of the command is something like this:
[user@linux]$ time ls -alh
total 48K
drwxr-xr-x 3 junk user 4.0K Jun 27 19:21 .
drwxr-xr-x 18 user user 4.0K Apr 6 11:45 ..
-rw------- 1 user user 51 Jun 27 19:21 .Xauthority

real 0m0.005s
user 0m0.000s
sys 0m0.010s

what does this real , user and sys time means?

any good link to the detailed explanation will be very helpful for me.

TIA
 
Old 06-26-2006, 09:34 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Linux comes with so called man pages (short for manual pages). Most commands come with a man page.

man time for example, gives you all sorts of information about the time program, including the answer to your question:

real - Elapsed real time (in [hours:]minutes:seconds).
user - (Not in tcsh.) Elapsed real time (in seconds).
sys - Total number of CPU-seconds that the process spent in kernel mode.

Hope this helps.
 
Old 06-27-2006, 03:01 AM   #3
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
I haven't checked the man pages, but there are generally 3 types of "time" recorded for any Linux/Unix process:
time spent in "user space", time spent in "kernel space" and the time duration "on the clock".

User space is the part of memory where normal programs are loaded and executed from.
Kernel space is entered whenever the program does a so-called "system call", which simply means that it calls the operating system (Linux in this case) to perform a standard system operation, like reading a part of a file on disk. When this operation is done, the program will return back to "user space".
The "time on the clock" is simply the time it took for the program to complete, as if it was measured by a stopwatch. This should always be >= the sum of the user and system times, because the program you have time'd is alternated with all other running programs (processes)
(All processes get to run, one after another, for short periods of time, depending on things like priority, niceness, etc.)

Please note also that kernel space has different "rules" than user space. For instance, kernel routines are often made uninterruptable (so, the system can't switch to another process in the middle of the system call), so that the hardware can't get messed up.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
command execution time minil Programming 10 08-20-2010 04:59 PM
calcualte the execution time of a function George2 Programming 4 06-15-2006 03:13 AM
retrieving execution time for process dipenchaudhary Programming 3 02-24-2006 10:27 AM
How do I Set MySQL Max Query Execution Time? farmerjoe Linux - General 1 01-26-2005 01:12 PM
how to [time] the execution hq4ever Linux - General 8 07-03-2004 04:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration