PDA

View Full Version : Not understanding CPU C programming benchmarks...



Kleid-0
07-21-2005, 10:52 PM
Hello everyone, I was reading about POSIX threads and they gave a table about CPU usage. I don't understand the difference between real, user, and sys :(. Could somebody help me out?

ILoveVectors
07-21-2005, 11:14 PM
Real - The elapsed (real) time between invocation of the application being timed and its termination.

User - The User CPU time, equivalent to the sum of the tms_utime10.1 and tms_cutime 10.2fields returned by the times(2) function for the process in which utility is executed.

Sys - The System CPU time, equivalent to the sum of the tms_stime 10.3 and tms_cstime 10.4 fields returned by the times(2) function for the process in which utility is executed.

Kleid-0
07-21-2005, 11:23 PM
Could you clarify on the difference between User and Sys time?

ILoveVectors
07-21-2005, 11:28 PM
http://www.wiu.edu/users/mflll/351/time.html

kermit
07-22-2005, 03:49 AM
Could you clarify on the difference between User and Sys time?

On a UNIX system, a process (an instance of a program running) will be executing in one of two modes; user mode, or kernel mode. The process will generally be in user mode until, for example, a system call is made. Then the mode switches to kernel mode in order to service the request. I believe that user time and system time corresponds to the time spent in both user mode and kernel mode respectively.

If you are using a *nix machine (and I have assumed that you are) then look at the man pages for time and times(2)

~/