opensubscriber
   Find in this group all groups
 
Unknown more information…

l : linux-c-programming@vger.kernel.org 5 April 2008 • 10:45AM -0400

Re: times()
by Glynn Clements

REPLY TO AUTHOR
 
REPLY TO GROUP





João Fernandes Simplício wrote:

> I've been testing the times() function and I can't understand in what
> way is the ticking being incremented for system time measurement
> (tms_stime). I understand that tms_utime gives the ticking related to
> the process and what does tms_stime gives?

tms_utime is the amount of CPU time spent executing user-space code
(i.e. the executable and shared libraries), while tms_stime is the
amount of CPU time spent in the kernel.

> E.g.:
>
> In 5 minutes the process gives 10000 ticks, so if the OS supports a
> maximum of 32758 process identifiers this gives us a 30% of load.
>
> Is my thinking right or am I missing something else?

The number of PIDs doesn't come into it.

times() reports the CPU time used by a single process.

If sysconf(_SC_CLK_TCK) is 100, then 5 minutes is 5*60*100 = 30000
ticks, so 10000 ticks corresponds to 33% of the CPU time being used by
that process.

Also, note that 100% correponds to full utilisation of a single CPU.
If you have multiple CPUs (a single CPU chip with multiple cores is
treated as multiple CPUs), a multi-threaded process can exceed 100%
CPU.

--
Glynn Clements <glynn@gcle...>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger...
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.