RE: "time" command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



System and user time would only be 99 or 100% if your process is
processor intensive and the only process using the CPU on a single CPU
system.  Any time spent waiting for I/O, etc., would cause the %CPU to
go down, since that's time that your program is "running" without using
the CPU.  Also, if other processes are competing for the CPU, then it
will get a smaller percentage of the CPU time.  For example, if there
are two processes both competing for the processor, they would both get
roughly 50% of the CPU time.  Also, on multiple CPU systems, a
single-threaded process will only run on one of the processors (at a
time) and hence will only get a percentage of the total CPU time
available.  For example, on a 2-CPU system, your process would get up to
and not more than 50% of the total CPU capacity.

So, basically, your assumption is wrong.  System and user time only
represent the amount of CPU time that a process uses, and do not
necessarily add up to the total elapsed time that a process has run and
do not necessarily directly correspond to the % CPU time like your doing
it.  Something like this might be a little closer to reality:

%CPU = (system + user) / (elapsed * num_CPUs)

Thanks,
Lyle


-----Original Message-----
From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On
Behalf Of nyi nge
Sent: Wednesday, July 14, 2004 4:45 PM
To: gcc-help@xxxxxxxxxxx
Subject: "time" command

Hi 

I have run "time" command for my program and I got the
following result. Percentage of CPU should be equal to
user time + sys time divided by elapsed time (that
should be 99%). But here I got only 18%. Any
explanation? Can I still use User time as the correct
result? 

User time (seconds): 52498.19
System time (seconds): 105.10
Percent of CPU this job got: 18%
Elapsed (wall clock) time (h:mm:ss or m:ss): 14:37:00
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 0
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 171
Minor (reclaiming a frame) page faults: 9258265
Voluntary context switches: 0
Involuntary context switches: 0
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0




		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux