[Orca-checkins] r496 - orca/trunk/data_gatherers/procallator

blair at orcaware.com blair at orcaware.com
Thu Sep 22 21:42:35 PDT 2005


Author: blair at orcaware.com
Date: Thu Sep 22 21:41:44 2005
New Revision: 496

Modified:
   orca/trunk/data_gatherers/procallator/procallator.pl.in

Log:
On a 2.6 kernel, procallator's cached memory statistic value (Cached
in /proc/meminfo) gets clobbered by the regular expression match that
also matches on SwapCached.

Suggested by: John Coleman <john.coleman at yale.edu>

* data_gatherers/procallator/procallator.pl.in:
  Instead of using regular expressions to match the data in
    /proc/mmeminfo, split the fields out and then use eq.


Modified: orca/trunk/data_gatherers/procallator/procallator.pl.in
==============================================================================
--- orca/trunk/data_gatherers/procallator/procallator.pl.in	(original)
+++ orca/trunk/data_gatherers/procallator/procallator.pl.in	Thu Sep 22 21:41:44 2005
@@ -459,32 +459,27 @@
     }
     else {
         while ( $line = <F_MEMINFO> ) {
-            if ( $line =~ /MemTotal/ ) {
-                ( $dumb, $mem_total ) = split / +/, $line;
-            }
-            if ( $line =~ /MemFree/ ) {
-                ( $dumb, $mem_free ) = split / +/, $line;
-            }
-            if ( $line =~ /Buffers/ ) {
-                ( $dumb, $mem_buff ) = split / +/, $line;
-            }
-            if ( $line =~ /Cached/ ) {
-                ( $dumb, $mem_cchd ) = split / +/, $line;
-            }
-            if ( $line =~ /Shared/ ) {
-                ( $dumb, $mem_shrd ) = split / +/, $line
-                  ; # It does not exist anymore -- maybe get will have to get from /proc/sysvipc/shm ?
-            }
-
-            #if ( $line=~/SwapCached/) {
-            #    ($dumb, $mem_swpcchd)= split / +/,$line;
-            #}
-            if ( $line =~ /SwapTotal/ ) {
-                ( $dumb, $swp_total ) = split / +/, $line;
-            }
-            if ( $line =~ /SwapFree/ ) {
-                ( $dumb, $swp_free ) = split / +/, $line;
-            }
+            ( $dumb, $value ) = split / +/, $line;
+            if ( $dumb eq 'MemTotal:' ) {
+                $mem_total = $value;
+            } elsif ( $dumb eq 'MemFree:' ) {
+                $mem_free = $value;
+            } elsif ( $dumb eq 'Buffers:' ) {
+                $mem_buff = $value;
+            } elsif ( $dumb eq 'Cached:' ) {
+                $mem_cchd = $value;
+            } elsif ( $dumb eq 'Shared:' ) {
+                # It does not exist anymore -- maybe get will have to
+                # get from /proc/sysvipc/shm?
+                $mem_shrd = $value;
+            } elsif ( $dumb eq 'SwapTotal:' ) {
+                $swp_total = $value;
+            } elsif ( $dumb eq 'SwapFree:' ) {
+                $swp_free = $value;
+            }
+            # elsif ( $dump eq 'SwapCached:' ) {
+            #     $mem_swpcchd = $value;
+            # }
         }
         $mem_used = $mem_total - $mem_free;
         $swp_used = $swp_total - $swp_free;



More information about the Orca-checkins mailing list