c21b20505c
toddpw@ in PR pkg/24921. While here, clean up the English in DESCR and use bl3.
31 lines
622 B
Text
31 lines
622 B
Text
$NetBSD: patch-aa,v 1.3 2004/03/29 22:44:29 snj Exp $
|
|
|
|
--- hot-babe.c.orig Sat Sep 21 16:53:24 2002
|
|
+++ hot-babe.c
|
|
@@ -74,6 +74,18 @@
|
|
/* returns current CPU load in percent, 0 to 256 */
|
|
static int system_cpu(void)
|
|
{
|
|
+#ifdef __NetBSD__
|
|
+ double l;
|
|
+ int i;
|
|
+ if (getloadavg(&l, 1) < 0)
|
|
+ return 0;
|
|
+ i = (l - 0.5) * (256/4);
|
|
+ if (i < 0)
|
|
+ i = 0;
|
|
+ if (i > 256)
|
|
+ i = 256;
|
|
+ return i;
|
|
+#else
|
|
unsigned int cpuload;
|
|
u_int64_t load, total, oload, ototal;
|
|
u_int64_t ab, ac, ad, ae;
|
|
@@ -111,6 +123,7 @@
|
|
cpuload = (256 * (load - oload)) / (total - ototal);
|
|
|
|
return cpuload;
|
|
+#endif
|
|
}
|
|
|
|
|