Files
libgtop/debian/patches/05_cpu_values.dpatch
2004-03-27 12:24:05 +00:00

53 lines
1.6 KiB
Plaintext

#!/bin/sh -e
## 05_cpu_values.dpatch by Sebastien Bacher <seb128@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
if [ $# -lt 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
case "$1" in
-patch) patch $patch_opts -p1 < $0;;
-unpatch) patch $patch_opts -p1 -R < $0;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1;;
esac
exit 0
@DPATCH@
diff -urNad /tmp/libgtop2-2.0.8/sysdeps/linux/cpu.c libgtop2-2.0.8/sysdeps/linux/cpu.c
--- /tmp/libgtop2-2.0.8/sysdeps/linux/cpu.c 2003-10-19 18:55:39.000000000 +0200
+++ libgtop2-2.0.8/sysdeps/linux/cpu.c 2004-02-13 19:58:42.000000000 +0100
@@ -80,6 +80,11 @@
buf->sys = strtoul (p, &p, 0);
buf->idle = strtoul (p, &p, 0);
+ /* 2.6 kernel */
+ buf->idle += strtoull(p, &p, 0); /* "iowait" */
+ buf->sys += strtoull(p, &p, 0); /* "irq" */
+ buf->sys += strtoull(p, &p, 0); /* "softirq" */
+
total = buf->user;
total += buf->nice;
total += buf->sys;
@@ -99,6 +104,11 @@
buf->xcpu_sys [i] = strtoul (p, &p, 0);
buf->xcpu_idle [i] = strtoul (p, &p, 0);
+ /* 2.6 kernel */
+ buf->xcpu_idle [i] += strtoull(p, &p, 0); /* "iowait" */
+ buf->xcpu_sys [i] += strtoull(p, &p, 0); /* "irq" */
+ buf->xcpu_sys [i] += strtoull(p, &p, 0); /* "softirq" */
+
total = buf->xcpu_user [i];
total += buf->xcpu_nice [i];
total += buf->xcpu_sys [i];