Re: times()

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

 



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@xxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux