Package: xsysinfo
Version: 1.7-6

xsysinfo only uses the first four items of the cpu* lines in /proc/stat.
hence, it tries to make us believing that we need a new cpu when executing
i/o-intensive tasks as `dd if=/dev/sda of=/dev/null bs=8M`.
This is a consequence of an inappropriate normalization.

the patch attached fixes this problem for sarge and etch, but, it might
be that kernels 2.6.21 and above need further code (see also bug #413807).

`uname -a` yields
Linux sbase 2.6.14.3-pii-pcl #1 SMP PREEMPT Fri Jul 21 00:52:25 CEST 2006 i686 
GNU/Linux

Only in xsysinfo-1.7.orig: Makefile
diff -cr xsysinfo-1.7.orig-OLD/debian/changelog 
xsysinfo-1.7.orig/debian/changelog
*** xsysinfo-1.7.orig-OLD/debian/changelog      Sat Aug 11 04:14:43 2007
--- xsysinfo-1.7.orig/debian/changelog  Sun Aug 12 02:38:28 2007
***************
*** 1,3 ****
--- 1,11 ----
+ xsysinfo (1.7-6seidl) unstable; urgency=low
+ 
+   * fix some strange behavior in cpu load bars
+     the output for `dd if=/dev/sda of=/dev/null bs=8M` has now some sense
+     and is in good agreement with top
+ 
+  -- Stephan Seidl <[EMAIL PROTECTED]>  Sun, 12 Aug 2007 02:27:27 +0200
+ 
  xsysinfo (1.7-6) unstable; urgency=low
  
    * fix memleak in getloadCB() (closes: #413807)
diff -cr xsysinfo-1.7.orig-OLD/sysinfo.c xsysinfo-1.7.orig/sysinfo.c
*** xsysinfo-1.7.orig-OLD/sysinfo.c     Sat Aug 11 04:14:43 2007
--- xsysinfo-1.7.orig/sysinfo.c Sun Aug 12 02:30:47 2007
***************
*** 185,192 ****
--- 185,212 ----
                loadptr = last_load + index;
  
        bufptr = strstr(bufptr, result->cpu);
+ #if (1)
+       {
+               /* from 2.6 .../Documentation/filesystems/proc.txt */
+               unsigned long aux_us = 0, /* normal processes executing in user 
mode */
+                             aux_ni = 0, /* niced  processes executing in user 
mode */
+                             aux_sy = 0, /* processes executing in kernel mode 
*/
+                             aux_id = 0, /* twiddling thumbs */
+                             aux_wa = 0, /* waiting for I/O to complete */
+                             aux_hi = 0, /* servicing hardware interrupts */
+                             aux_si = 0; /* servicing softirqs */
+               sscanf( bufptr, "%*s %lu %lu %lu %lu %lu %lu %lu\n",
+                       &aux_us, &aux_ni, &aux_sy, &aux_id,
+                       &aux_wa, &aux_hi, &aux_si );
+               curr_load.user   = aux_us;
+               curr_load.nice   = aux_ni;
+               curr_load.system = aux_sy + aux_hi + aux_si;
+               curr_load.idle   = aux_id + aux_wa;
+       }
+ #else
        sscanf( bufptr, "%*s %lu %lu %lu %lu\n", &curr_load.user,
                &curr_load.nice, &curr_load.system, &curr_load.idle );
+ #endif
        curr_load.total = curr_load.user + curr_load.nice + curr_load.system +
                curr_load.idle;
  

Reply via email to