Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-07-2005, 04:23 PM   #1
Registered: Feb 2003
Distribution: Slackware
Posts: 38

Rep: Reputation: 17
/proc/stat cpu info

I'm working on a way to graph the load on both cpu's in an SMP system with kernel 2.6.12. The data to calculate the loads is in /proc/stat, but man proc and all info pages on /proc/stat only list 4 values - user/nice/system/idle
my system has 8 numbers for each cpu!

cpu 1199107 0 246925 212921410 362550 4623 18624 0
cpu0 729178 0 128171 106183948 312786 4623 17918 0
cpu1 469929 0 118754 106737461 49764 0 706 0

why the extra 4 values? anyone?
Old 10-10-2005, 07:22 AM   #2
Registered: Jan 2005
Location: Shropshire, England, UK
Distribution: RedHat, Fedora, CentOS..........
Posts: 121

Rep: Reputation: 19
The stats do vary depending upon your CPU but assuming you have an x86 the values according the the kernel documentation (kernel 2.6.13) the values have the following meanings.

The very first  "cpu" line aggregates the  numbers 
in all  of the other "cpuN" lines.  These numbers 
identify the amount of time the CPU has spent 
performingdifferent kinds of work.  Time units are 
in USER_HZ (typically hundredths of a second).  
The meanings of the columns are as follows, from 
left to right:

- user: normal processes executing in user mode
- nice: niced processes executing in user mode
- system: processes executing in kernel mode
- idle: twiddling thumbs
- iowait: waiting for I/O to complete
- irq: servicing interrupts
- softirq: servicing softirqs
Old 10-11-2005, 03:16 PM   #3
Registered: Feb 2003
Distribution: Slackware
Posts: 38

Original Poster
Rep: Reputation: 17
there's actually 8 on mine and the last is a 0, but as long as the first 4 are still user,nice,system,idle I should be able to add the first 3 and get a percentage of #4 to get the actual load. (the exact calculation is floating around the net, I'll dig it back up). Thanks for the clarification


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
/proc/stat file problem for cpu usage arunka Programming 3 04-23-2014 01:08 PM
/proc/stat values don't add up ! mike0w Linux - General 0 10-25-2005 05:01 AM
New cpu values in /proc/stat? eldonz Linux - General 1 10-19-2005 12:16 PM
/proc/stat cpu ahz Programming 1 04-24-2005 07:24 AM
Calculating total %cpu usage from /proc/stat gaijin Programming 1 07-07-2004 02:45 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:51 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration