diff options
| author | Paul Mackerras <paulus@samba.org> | 2005-03-04 17:32:31 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-03-04 17:32:31 -0800 |
| commit | 8e9014435180c54811db0ad446941bb33b1e5e26 (patch) | |
| tree | ee277c3607c328ffb4b36cce1cf5dc6c29d12640 /include | |
| parent | 88e470bf9d2df529c5a05fd549bd9ae1f37e2f0e (diff) | |
[PATCH] ppc64: collect and export low-level cpu usage statistics
POWER5 machines have a per-hardware-thread register which counts at a rate
which is proportional to the percentage of cycles on which the cpu
dispatches an instruction for this thread (if the thread gets all the
dispatch cycles it counts at the same rate as the timebase register). This
register is also context-switched by the hypervisor. Thus it gives a
fine-grained measure of the actual cpu usage by the thread over time.
This patch adds code to read this register every timer interrupt and on
every context switch. The total over all virtual processors is available
through the existing /proc/ppc64/lparcfg file, giving a way to measure the
total cpu usage over the whole partition.
Signed-off-by: Manish Ahuja <ahuja@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-ppc64/processor.h | 4 | ||||
| -rw-r--r-- | include/asm-ppc64/time.h | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h index e524e77186db..ae3a5bb3ea98 100644 --- a/include/asm-ppc64/processor.h +++ b/include/asm-ppc64/processor.h @@ -562,7 +562,9 @@ struct thread_struct { double fpr[32]; /* Complete floating point set */ unsigned long fpscr; /* Floating point status (plus pad) */ unsigned long fpexc_mode; /* Floating-point exception mode */ - unsigned long pad[3]; /* was saved_msr, saved_softe */ + unsigned long start_tb; /* Start purr when proc switched in */ + unsigned long accum_tb; /* Total accumilated purr for process */ + unsigned long pad; /* was saved_msr, saved_softe */ #ifdef CONFIG_ALTIVEC /* Complete AltiVec register set */ vector128 vr[32] __attribute((aligned(16))); diff --git a/include/asm-ppc64/time.h b/include/asm-ppc64/time.h index 362d9d90acda..b7205e3b7193 100644 --- a/include/asm-ppc64/time.h +++ b/include/asm-ppc64/time.h @@ -102,5 +102,14 @@ static inline unsigned long tb_ticks_since(unsigned long tstamp) unsigned mulhwu_scale_factor(unsigned, unsigned); void div128_by_32( unsigned long dividend_high, unsigned long dividend_low, unsigned divisor, struct div_result *dr ); + +/* Used to store Processor Utilization register (purr) values */ + +struct cpu_usage { + u64 current_tb; /* Holds the current purr register values */ +}; + +DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array); + #endif /* __KERNEL__ */ #endif /* __PPC64_TIME_H */ |
