46 lines
1.3 KiB
Text
46 lines
1.3 KiB
Text
$NetBSD: patch-ap,v 1.4 2006/01/05 20:25:16 joerg Exp $
|
|
|
|
--- ksim/monitors/cpu/ksimcpu.cpp.orig 2005-10-05 13:26:45.000000000 +0000
|
|
+++ ksim/monitors/cpu/ksimcpu.cpp
|
|
@@ -44,7 +44,13 @@
|
|
|
|
#ifdef Q_OS_BSD4
|
|
#include <sys/param.h>
|
|
-#ifdef Q_OS_FREEBSD
|
|
+#if defined(__DragonFly__)
|
|
+#include <kinfo.h>
|
|
+#include <err.h>
|
|
+#include <sys/time.h>
|
|
+#include <sys/resource.h>
|
|
+
|
|
+#elif defined Q_OS_FREEBSD
|
|
#if __FreeBSD_version < 500101
|
|
#include <sys/dkstat.h>
|
|
#else
|
|
@@ -235,7 +241,15 @@ void CpuView::updateCpu(CpuData &cpu, in
|
|
fseek(m_procFile, 0L, SEEK_SET);
|
|
#endif
|
|
|
|
-#ifdef Q_OS_FREEBSD
|
|
+#ifdef __DragonFly__
|
|
+ struct kinfo_cputime cp_time;
|
|
+ if (kinfo_get_sched_cputime(&cp_time))
|
|
+ err(1, "kinfo_get_sched_cputime");
|
|
+ cpu.user = cp_time.cp_user;
|
|
+ cpu.nice = cp_time.cp_nice;
|
|
+ cpu.sys = cp_time.cp_sys;
|
|
+ cpu.idle = cp_time.cp_idle;
|
|
+#elif defined(Q_OS_FREEBSD)
|
|
#warning "add support for SMP on FreeBSD"
|
|
Q_UNUSED(cpuNumber);
|
|
static int name2oid[2] = { 0, 3 };
|
|
@@ -265,6 +279,9 @@ void CpuView::updateCpu(CpuData &cpu, in
|
|
cpu.idle = cpuTime[CP_IDLE];
|
|
#endif
|
|
|
|
+#if defined(Q_OS_NETBSD)
|
|
+#define KERN_CPTIME KERN_CP_TIME
|
|
+#endif
|
|
#if defined(Q_OS_OPENBSD) || defined(Q_OS_NETBSD)
|
|
//#warning "add support for SMP on OpenBSD and NetBSD"
|
|
int name2oid[2] = { CTL_KERN, KERN_CPTIME };
|