pkgsrc/sysutils/xfce4-cpugraph-plugin/patches/patch-ab
joerg 485c929273 Catch up with change in the plugin. Adjust configure.ac for the kinfo
check and regen it for now using autoconf. Can't figure out how to
produce a minimal diff.
2007-04-17 13:05:08 +00:00

31 lines
846 B
Text

$NetBSD: patch-ab,v 1.4 2007/04/17 13:05:08 joerg Exp $
--- panel-plugin/os.c.orig 2004-07-24 17:25:15.000000000 +0000
+++ panel-plugin/os.c
@@ -67,6 +67,26 @@ long GetCPUUsage (int *oldusage, int *ol
return usage;
}
+#elif defined(__DragonFly__)
+long GetCPUUsage (int *oldusage, int *oldtotal)
+{
+ long used, total, usage;
+ struct kinfo_cputime cp_time;
+
+ if (kinfo_get_sched_cputime(&cp_time) < 0) {
+ printf ("kinfo_get_sched_cputime failed");
+ return -1;
+ }
+ used = cp_time.cp_user + cp_time.cp_nice + cp_time.cp_sys;
+ total = used + cp_time.cp_idle;
+ if (total != *oldtotal)
+ usage = 100 * (used - *oldusage + used / 2 - *oldusage / 2) / (total - *oldtotal);
+ else
+ usage = 0;
+ *oldusage = used;
+ *oldtotal = total;
+ return usage;
+}
#elif defined (__NetBSD__)
long GetCPUUsage (int *oldusage, int *oldtotal)
{