aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorMichael Holzheu <holzheu@linux.vnet.ibm.com>2010-10-27 18:34:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-27 21:03:17 -0400
commitd57af9b2142f31a39dcfdeb30776baadfc802827 (patch)
treea89233b1e57b152c9bebf7bb516dd51920602969 /arch/powerpc
parent3d9e0cf1fe007b88db55d43dfdb6839e1a029ca5 (diff)
taskstats: use real microsecond granularity for CPU times
The taskstats interface uses microsecond granularity for the user and system time values. The conversion from cputime to the taskstats values uses the cputime_to_msecs primitive which effectively limits the granularity to milliseconds. Add the cputime_to_usecs primitive for architectures that have better, more precise CPU time values. Remove cputime_to_msecs primitive because there are no more users left. Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: Luck Tony <tony.luck@intel.com> Cc: Shailabh Nagar <nagar1234@in.ibm.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Shailabh Nagar <nagar@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/include/asm/cputime.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h
index 8bdc6a9e5773..1cf20bdfbeca 100644
--- a/arch/powerpc/include/asm/cputime.h
+++ b/arch/powerpc/include/asm/cputime.h
@@ -124,23 +124,23 @@ static inline u64 cputime64_to_jiffies64(const cputime_t ct)
124} 124}
125 125
126/* 126/*
127 * Convert cputime <-> milliseconds 127 * Convert cputime <-> microseconds
128 */ 128 */
129extern u64 __cputime_msec_factor; 129extern u64 __cputime_msec_factor;
130 130
131static inline unsigned long cputime_to_msecs(const cputime_t ct) 131static inline unsigned long cputime_to_usecs(const cputime_t ct)
132{ 132{
133 return mulhdu(ct, __cputime_msec_factor); 133 return mulhdu(ct, __cputime_msec_factor) * USEC_PER_MSEC;
134} 134}
135 135
136static inline cputime_t msecs_to_cputime(const unsigned long ms) 136static inline cputime_t usecs_to_cputime(const unsigned long us)
137{ 137{
138 cputime_t ct; 138 cputime_t ct;
139 unsigned long sec; 139 unsigned long sec;
140 140
141 /* have to be a little careful about overflow */ 141 /* have to be a little careful about overflow */
142 ct = ms % 1000; 142 ct = us % 1000000;
143 sec = ms / 1000; 143 sec = us / 1000000;
144 if (ct) { 144 if (ct) {
145 ct *= tb_ticks_per_sec; 145 ct *= tb_ticks_per_sec;
146 do_div(ct, 1000); 146 do_div(ct, 1000);