Re: /proc/stat cpu data

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

 



Rafael C. de Almeida wrote:
> Hello,
> 
> I'm interested in knowing how the cpu data from /proc/stat is gathered.
> Following my way from this function:
> 	http://lxr.linux.no/linux+v2.6.25.10/fs/proc/proc_misc.c#L459
> I've figured that the time is probably gathered using those
> account_*_time on sched.c. I'm not sure where the times are read from,
> though.
> 
> Anyhow, I thought I'd do a little test. I expected that if I added
> together all the values on the cpu line of /proc/stat, waited 1 second
> and added together all the values again, then their difference would be
> a constant value. That is, the value should be the same any time I would
> repeat the experiment. My reasoning was that those values accounted for
> some unit of time and that the amount of time units between seconds
> should always be the same. I expected a small variation due to the
> kernel not always being able to wake the process that was doing the
> measurement in exactly one second.

<snip>

> I found those values rather odd. There were 40 values above 200 and 7
> above 300. I didn't expect those big values to show up. I think there
> might be a relation between the system utilization and the variation,
> but I'm not sure. Why does it happen? Should I ask this on lkml as well?

I runned a few cpu-bound process and it didn't make for big variations.
Now, if I'd do dd if=/dev/zero of=/tmp/foo then I'd experience big
variations on the values. I really can't understand what's going on here
:-/.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux