53 lines
1.3 KiB
Text
53 lines
1.3 KiB
Text
$NetBSD: patch-ae,v 1.1 2007/02/19 19:50:48 joerg Exp $
|
|
|
|
--- freebsd.c.orig 2007-02-19 19:26:16.000000000 +0000
|
|
+++ freebsd.c
|
|
@@ -13,7 +13,11 @@
|
|
#include <sys/types.h>
|
|
#include <sys/time.h>
|
|
#include <sys/vmmeter.h>
|
|
+#ifdef __DragonFly__
|
|
+#include <kinfo.h>
|
|
+#else
|
|
#include <sys/dkstat.h>
|
|
+#endif
|
|
#include <unistd.h>
|
|
#include <sys/user.h>
|
|
#include <sys/socket.h>
|
|
@@ -251,6 +255,19 @@ long cpu_used, oldtotal, oldused;
|
|
|
|
void update_cpu_usage() {
|
|
long used, total;
|
|
+#ifdef __DragonFly__
|
|
+ struct kinfo_cputime cp_time;
|
|
+
|
|
+ if (kinfo_get_sched_cputime(&cp_time)) {
|
|
+ fprintf(stderr, "kinfo_get_sched_cputime failed");
|
|
+ return;
|
|
+ }
|
|
+ fresh.load[0] = cp_time.cp_user;
|
|
+ fresh.load[0] = cp_time.cp_nice;
|
|
+ fresh.load[0] = cp_time.cp_sys;
|
|
+ fresh.load[0] = cp_time.cp_idle;
|
|
+ fresh.load[0] = cp_time.cp_idle;
|
|
+#else
|
|
long cp_time[CPUSTATES];
|
|
size_t len = sizeof(cp_time);
|
|
|
|
@@ -263,6 +280,7 @@ void update_cpu_usage() {
|
|
fresh.load[2] = cp_time[CP_SYS];
|
|
fresh.load[3] = cp_time[CP_IDLE];
|
|
fresh.load[4] = cp_time[CP_IDLE];
|
|
+#endif
|
|
|
|
used = fresh.load[0] + fresh.load[1] + fresh.load[2];
|
|
total = fresh.load[0] + fresh.load[1] + fresh.load[2] + fresh.load[3];
|
|
@@ -345,3 +363,8 @@ char* get_acpi_ac_adapter(void)
|
|
char* get_acpi_fan() {
|
|
return "";
|
|
}
|
|
+
|
|
+char * get_freq()
|
|
+{
|
|
+ return "";
|
|
+}
|