Dear friend :
I have doubt How , system cpu and user cpu times
calculates
Thanks
|
|
0
|
|
|
|
Reply
|
pavunkumar
|
2/28/2009 7:48:03 AM |
|
pavunkumar wrote:
> Dear friend :
>
> I have doubt How , system cpu and user cpu times
> calculates
When using the time shell command on GNU/Linux (I'm pretty sure it's the same on other systems), user CPU time is the sum of CPU time slices executed in user mode for this process, while sys CPU time is the sum of CPU time slices executed in kernel mode for this process.
Note that when a process is either in interruptible sleep for it blocks on pipe/socket I/O, a sleep() command, or a thread synchronization function, or uninterruptible sleep (e.g. blocking on regular file I/O), the CPU isn't executing this process at all, and so, the CPU time isn't counted for this process.
Real time is the clock time at the end of the process execution minus the clock time at the beginning of the process execution. It's the time you can calculate with your watch, while looking at process's execution.
Examples (on my computer):
$ time cat
[wait a few seconds]^D
real 0m2.250s
user 0m0.001s
sys 0m0.001s
$ time dd if=/dev/hda2 of=/dev/null bs=1048576 count=100
[...]
real 0m3.501s
user 0m0.007s
sys 0m0.446s
Note that kernel time should never count time of kernel threads that aren't bound to any process. These threads might do the actual work, while kernel threads might simply queue messages or I/O requests to the working threads.
|
|
0
|
|
|
|
Reply
|
UTF
|
2/28/2009 11:40:01 AM
|
|