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

Re: getloadavg and proc filesystem

Hash: SHA1

Dear List,

I finally got around to asking the linux kernel mailing list about
reading from the proc filesystem, and reading /proc/stat

These are the two most interesting comments to note:

On Dec 5, 2005, at 4:58 PM, Bernd Eckenfels wrote:
the files in proc are all to some degree atomic to some not. You will have
to look into the source for the specific file to see the details. For
smaller files if they fit into a single 4k page you have good chances.
Bigger files can cause all kind of trouble. (most often you miss new

In case of stat the readings should be consistent within itself since all
cpu lines fit into a single page.

and secondly regarding exactly on how to read /proc/stat

On Dec 7, 2005, at 4:12 PM, Rik van Riel wrote:
On Wed, 7 Dec 2005, Andrew Miehs wrote:

After reading your mail http://mail.nl.linux.org/linux-mm/2002-05/ msg00099.html regarding the implementation of iowait in /proc/ stat, I was wondering what the best method was to calculate iowait statistics.

According to point 3...

3) iowait time is counted separately from user/system/idle and
  can overlap with either system or idle (when no process is
  running the system can still be busy processing interrupts)

is it correct to assume that
  user + system + idle + nice + interrupts + iowait > 100% cputime

No, the total = 100%


Version: GnuPG v1.4.1 (Darwin)


Reply to: