[Orca-users] Problems due to changes to Linux /proc/* with 2.6 kernels

Cynthia Kiser cnk at caltech.edu
Fri Dec 3 14:17:48 PST 2004


I installed Orcaware on a Fedora Core 2 system and am very impressed
with the data collected. However, there seem to have been some changes
to information collected in various parts of the /proc/ file
sytem. But comparing the code in the procollator scrip and the output
of 'cat /proc/meminfo' on a RedHat 7.3 system and my FC 2 system, I
was able to get memory and swap usage stats working (and then found a
very similar fix in the archives of the developer list). 

However, I have not found a patch for the changes that make the disk
system (reads/writes and transfer rate), paging, and swap graphs
blank. Procollator looks for that information in /proc/stat (see
exerpt below). But that information is not longer reported in
/proc/stat. I am willing to try to make a patch if someone can give me
some advice about where to look for the analogous information.

I also have a quick question about procolator's design. The summary
lines in /proc/meminfo have been dropped, but one can get the same
information by running free. That is really easy to do from perl, but
I was wondering if it was a good idea to do so. Or whether I should
replace my use of `free` with the loop that was detailed in
http://www.orcaware.com/pipermail/orca-dev/2004-August/000533.html? 

Thanks in advance,  

RedHat 7.3 system

# cat /proc/stat
cpu  35944546 13854 59335360 1249201700
cpu0 13133514 6717 22627505 636479994
cpu1 22811032 7137 36707855 612721706
page 96900246 190761205
swap 12583 30261
intr 773908065 672247730 3777 0 0 4 0 1320 0 1 0 0 0 2783 0 2 0 0
45980400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 55672048 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0
disk_io: (2,0):(224,153,8596,71,6150)
(8,0):(6680613,224138,5494564,6456475,188167642)
(8,1):(12774571,1416119,188296402,11358452,193348592) 
ctxt 653089981
btime 1095388598
processes 1148951

Fedora Core 2 system

# cat /proc/stat
cpu  20008342 3824066 2057054 58582506 126795 6984 0
cpu0 20008342 3824066 2057054 58582506 126795 6984 0
intr 854624515 846186128 22780 0 0 5 0 4 1 1 0 0 5266670 289550 0
2022670 836706
ctxt 216397224
btime 1101265270
processes 3467517
procs_running 4
procs_blocked 0
preempt 118415344


Line 87 on in bin/procollator

   # Read system stats 
   open (F_STAT, "<$PROC/stat"); 
   $n_cpus=0; 
   while ( $line=<F_STAT> ) { 
      chomp ($line); 
      if ( $line=~/cpu[0-9]*/ ) {  
         ($cpu[$r][$n_cpus], $usr[$r][$n_cpus], $nice[$r][$n_cpus],
$sys[$r][$n_cpus], $idle[$r][$n_cpus])= split / +/,$line; 
         $total[$r][$n_cpus]= $usr[$r][$n_cpus] + $nice[$r][$n_cpus] +
$sys[$r][$n_cpus] + $idle[$r][$n_cpus]\
; 
         $n_cpus++; 
      } 
      if ( $line=~/page/) { 
         ($dumb, $page_in[$r], $page_out[$r])= split / +/,$line; 
      } 
      if ( $line=~/swap/) { 
         ($dumb, $swap_in[$r], $swap_out[$r])= split / +/,$line; 
      } 
      if ( $line=~/ctxt/) { 
         ($dumb, $ctxt[$r])=  split / +/,$line; 
      } 
      if ( $line=~/intr/) { 
         @dumb=split / /,$line; 
         $intr[$r]=0; 
         $i=1; 
         while ($i<@dumb) { 
            $intr[$r]+=$dumb[$i]; 
            $i++; 
         } 
      } 
       
      # Linux 2.4 style I/O report 
      if ( $line=~/disk_io/ ) { 
         @dsk=0; 
         $i=0; 
         ($dsk_stat_t[$r],$dsk_rio_t[$r],$dsk_rblk_t[$r],$dsk_wio_t[$r],$dsk_wblk_t[$r])=(0,0,0,0); 
 
         ($dumb, $line)= split /: /,$line; 
         $n_dsk=@dsk= split / /,$line; 
 
         while ($i<$n_dsk) { 
            (  $dumb, 
               $dsk_maj[$r][$i],$dsk_min[$r][$i], 
               $dsk_stat[$r][$i], 
               $dsk_rio[$r][$i],$dsk_rblk[$r][$i], 
               $dsk_wio[$r][$i],$dsk_wblk[$r][$i] 
            ) = split /[^0-9]+/,$dsk[$i]; 
            $dsk_stat_t[$r]+=$dsk_stat[$r][$i]; 
            $dsk_rio_t[$r] +=$dsk_rio[$r][$i]; 
            $dsk_rblk_t[$r]+=$dsk_rblk[$r][$i]; 
            $dsk_wio_t[$r] +=$dsk_wio[$r][$i]; 
            $dsk_wblk_t[$r]+=$dsk_wblk[$r][$i]; 
            $i++; 
         } 
      }

-- 
Cynthia Kiser




More information about the Orca-users mailing list