Bug 134704

Summary: ktimemon incorrectly reports the slab usage
Product: ktimemon Reporter: James Stark <jstark>
Component: generalAssignee: Dirk Mueller <mueller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description James Stark 2006-09-26 21:07:08 UTC
Version:            (using KDE KDE 3.5.4)
Installed from:    Debian testing/unstable Packages
Compiler:          gcc 4.1.1 
OS:                Linux

ktimemon is currently reporting the memory used by the slab twice.  It is being reported as both kernel memory and user memory.  For a small slab size this isn't noticeable, however if the slab grows to being a significant portion of memory (running updatedb will cause this to happen) then the memory usage reported by ktimemon will become noticeably incorrect.

The following patch corrects the problem:

diff -Naur kdeaddons-3.5.4-orig/kicker-applets/ktimemon/sample.cc kdeaddons-3.5.4/kicker-applets/ktimemon/sample.cc
--- kdeaddons-3.5.4-orig/kicker-applets/ktimemon/sample.cc      2006-09-26 18:35:22.000000000 +0000
+++ kdeaddons-3.5.4/kicker-applets/ktimemon/sample.cc   2006-09-26 18:32:34.000000000 +0000
@@ -425,7 +425,7 @@

     sample.cputotal =
       sample.user + sample.nice + sample.kernel + sample.iowait + sample.idle;
-    sample.used = sample.mtotal - sample.free - sample.buffers - sample.cached;
+    sample.used = sample.mtotal - sample.mkernel - sample.free - sample.buffers - sample.cached;
     sample.sused = sample.stotal - sample.sfree;
 }
Comment 1 Dirk Mueller 2006-09-28 20:20:54 UTC
SVN commit 589831 by mueller:

fix kernel memory being counted twice. Thanks for the patch!
BUG:134704


 M  +2 -2      sample.cc  


--- branches/KDE/3.5/kdeaddons/kicker-applets/ktimemon/sample.cc #589830:589831
@@ -423,9 +423,9 @@
     sample.stotal = sample.sfree = 0;
 #endif
 
-    sample.cputotal = 
+    sample.cputotal =
       sample.user + sample.nice + sample.kernel + sample.iowait + sample.idle;
-    sample.used = sample.mtotal - sample.free - sample.buffers - sample.cached;
+    sample.used = sample.mtotal - sample.mkernel - sample.free - sample.buffers - sample.cached;
     sample.sused = sample.stotal - sample.sfree;
 }