* times()
@ 2008-04-04 23:04 João Fernandes Simplício
2008-04-05 2:45 ` times() Glynn Clements
0 siblings, 1 reply; 2+ messages in thread
From: João Fernandes Simplício @ 2008-04-04 23:04 UTC (permalink / raw)
To: linux-c-programming
Hello,
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?
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?
Best Regards,
-- João Simplício
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: times()
2008-04-04 23:04 times() João Fernandes Simplício
@ 2008-04-05 2:45 ` Glynn Clements
0 siblings, 0 replies; 2+ messages in thread
From: Glynn Clements @ 2008-04-05 2:45 UTC (permalink / raw)
To: João Fernandes Simplício; +Cc: linux-c-programming
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@gclements.plus.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-04-05 2:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-04 23:04 times() João Fernandes Simplício
2008-04-05 2:45 ` times() Glynn Clements
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).