From d98fff6ee17c38cea249b215ea63db42304eaf83 Mon Sep 17 00:00:00 2001 From: malc Date: Sun, 8 Jul 2007 17:37:03 +0400 Subject: [PATCH] v0.96 --- Changes | 3 +++ OMakefile | 2 +- README | 12 +++++++++++- mod/Makefile | 6 +++--- mod/itc-mod.c | 18 ++++++++++++++++-- 5 files changed, 34 insertions(+), 7 deletions(-) diff --git a/Changes b/Changes index 6ef5213..9180220 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +6 + * Linux/PPC(6xx) support + 5 * NT support diff --git a/OMakefile b/OMakefile index e5ca1ea..fc70de9 100644 --- a/OMakefile +++ b/OMakefile @@ -1,4 +1,4 @@ -version = 0.95 +version = 0.96 ocaml-includes = -I +lablGL diff --git a/README b/README index 7260f35..6248267 100644 --- a/README +++ b/README @@ -4,6 +4,12 @@ This is APC - graphical CPU load meter. It is more suitable/accurate in situations where applications generate "short" periodic bursts of activity. +It works by timing the time spent in the kernels idle handler. CPU +load time is taken to mean: + time spent in idle handler +1 - -------------------------- + total time elapsed + Kernel can use variety of values for HZ (most frequent: 100 250 1000) PAL/SECAM video frame grabbers do so with 25/50 FPS frequency, if the @@ -43,12 +49,14 @@ Tested on[2]: Linux 2.4.30 - AMD Athlon(tm) Processor (1.4 Ghz) Linux 2.6.17.6 - AMD Athlon(tm)64 X2 Dual Core Processor 3800+ Linux 2.6.18 - AMD Athlon(tm)64 3800+ +Linux 2.6.18.3 - PowerPC 7447A It's possible that RMClock[3] does something similar(load measuring wise) on Microsoft Windows. [1] Unlike `/proc/uptime'. But this one is useless for SMP -[2] SMP not tested on 2.4 kernels (nor QUIRK mode) +[2] SMP not tested on 2.4 kernels, nor QUIRK mode. SMP on PPC wasn't + tested at all [3] http://cpu.rightmark.org/products/rmclock.shtml ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -71,6 +79,8 @@ $ cd mod $ su -c 'insmod ./its.ko' - 2.6 Kernels $ su -c 'insmod ./its.o' - 2.4 Kernels +Following applies only to Linux running on X86. + If the module fails to load consult dmesg(8). Most likely cause is the lack of exported `default_idle' function and no specific power management idle function is specified. Few workarounds follow: diff --git a/mod/Makefile b/mod/Makefile index d8d74bb..d6cb3fd 100644 --- a/mod/Makefile +++ b/mod/Makefile @@ -21,11 +21,11 @@ endif itc-objs := itc-mod.o +hack := $(shell $(CC) -print-search-dirs | sed -n 's;^install: \(.*\);\1include;p;q') +export CPATH:=${CPATH}:${hack} + ifdef TOPDIR obj-m := itc.o -hack := $(shell $(CC) -print-search-dirs \ - | sed -n 's;^install: \(.*\);\1/include;p;q') -export CPATH := ${CPATH}:${hack} endif ifdef K24 diff --git a/mod/itc-mod.c b/mod/itc-mod.c index debe226..0676771 100644 --- a/mod/itc-mod.c +++ b/mod/itc-mod.c @@ -11,9 +11,19 @@ #include #include #include + #include #include +#ifdef CONFIG_6xx +#include +#define pm_idle ppc_md.power_save +#endif + +#if !(defined CONFIG_X86 || defined CONFIG_6xx) +#error Support for this architecture is not written yet +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 0) #include #ifdef CONFIG_SMP @@ -34,16 +44,18 @@ MODULE_DESCRIPTION ("Idle time collector"); -/* there are many ways to prevent gcc from complaining about module_param - and function pointer vs long, but let's not */ static void (*idle_func) (void); +#ifdef CONFIG_X86 +/* there are many ways to prevent gcc from complaining about module_param + and function pointer vs long, but let's not */ #if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 0) MODULE_PARM (idle_func, "l"); #else module_param (idle_func, long, 0777); #endif MODULE_PARM_DESC (idle_func, "address of default idle function"); +#endif #define DEVNAME "itc" static spinlock_t lock = SPIN_LOCK_UNLOCKED; @@ -216,6 +228,7 @@ itc_idle (void) struct timeval tv; unsigned long flags; + /* printk ("idle in\n"); */ spin_lock_irqsave (&lock, flags); itc = &global_itc[smp_processor_id ()]; do_gettimeofday (&itc->sleep_started); @@ -253,6 +266,7 @@ itc_idle (void) cpeamb (&itc->cumm_sleep_time, &tv, &itc->sleep_started); itc->sleeping = 0; spin_unlock_irqrestore (&lock, flags); + /* printk ("idle out\n"); */ } /********************************************************************** -- 2.11.4.GIT