Operating System - HP-UX
1833151 Members
3541 Online
110051 Solutions
New Discussion

query on time and timex command

 
SOLVED
Go to solution
Amit Jindal_1
Frequent Advisor

query on time and timex command

Hi,
I have a query on time or timex command.
Take the below example. My query is that what are the real / user and sys signifies. I saw the man page to become more confused.. Please help. [ I assume that the real time is the one which is the time taken for the command execution ]

root@host1:>time find /app >/dev/null
real 2.7
user 0.3
sys 2.2

I have seen the man page small caption below:
DESCRIPTION : command is executed. Upon completion, time prints the elapsed time
during the command, the time spent in the system, and the time spent executing the command. Times are reported in seconds.
7 REPLIES 7
Dennis Handly
Acclaimed Contributor

Re: query on time and timex command

>the real time is the one which is the time taken for the command execution

Yes, the time you would measure if you used a stopwatch. This includes all of the wait times which aren't included in user or sys.
Jeeshan
Honored Contributor

Re: query on time and timex command

timex reports in seconds the elapsed time, user time, and system time spent in execution of the given command.

And Upon completion, time prints the elapsed time
during the command, the time spent in the system, and the time spent executing the command.
a warrior never quits
Amit Jindal_1
Frequent Advisor

Re: query on time and timex command

Thanks for the quick replies .. Can you give some more description on user and sys time. [ Not in detail .. in simple defination ]
Jeeshan
Honored Contributor

Re: query on time and timex command

The user time is the time the cpu spent performing user related tasks (your script)

the system time is the time the cpu spent doing system related tasks (the kernel...)
a warrior never quits
Amit Jindal_1
Frequent Advisor

Re: query on time and timex command

still unable to understand .. sorry for that

In the contect of my example, what I assume and understand is : My command / script has got some system calls which have to be taken care by the kernel, in this case listing the files/dir from disk in /app area. So kernel took some time , that is sys time ?? is that correct .. I may be wrong .. then what is user time ?


root@host1:>time find /app >/dev/null
real 2.7
user 0.3
sys 2.2


Dennis Handly
Acclaimed Contributor
Solution

Re: query on time and timex command

>got some system calls which have to be taken care by the kernel, in this case listing the files/dir from disk. So kernel took some time, that is sys time??

Yes. System time is the time the kernel uses to manage the system. It could be swapping you in and out, setting up I/O, moving the data to your buffers, etc.

>then what is user time?

This is the time spent outside the kernel, in your executable or shlib.

Amit Jindal_1
Frequent Advisor

Re: query on time and timex command

Thanks Dennis for teh explanation.