From 639b19c90633c945f3919e74232ed0cf7b59c883 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 5 Jul 2006 11:24:26 +0100 Subject: [PATCH] --- yaml --- r: 32069 b: refs/heads/master c: a8e0c51c71fc973b400f6502382063553b82af5a h: refs/heads/master i: 32067: 3441788fe11ae4eb1169c3d7fa7cbba986797130 v: v3 --- [refs] | 2 +- trunk/include/asm-powerpc/cputime.h | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index eba7a4f1725d..786de3583627 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ba1826e5eced176cc9ec0033ad8ee0f1cd5ad2e4 +refs/heads/master: a8e0c51c71fc973b400f6502382063553b82af5a diff --git a/trunk/include/asm-powerpc/cputime.h b/trunk/include/asm-powerpc/cputime.h index a21185d47883..310804485208 100644 --- a/trunk/include/asm-powerpc/cputime.h +++ b/trunk/include/asm-powerpc/cputime.h @@ -43,6 +43,7 @@ typedef u64 cputime64_t; #define cputime64_zero ((cputime64_t)0) #define cputime64_add(__a, __b) ((__a) + (__b)) +#define cputime64_sub(__a, __b) ((__a) - (__b)) #define cputime_to_cputime64(__ct) (__ct) #ifdef __KERNEL__ @@ -74,6 +75,23 @@ static inline cputime_t jiffies_to_cputime(const unsigned long jif) return ct; } +static inline cputime64_t jiffies64_to_cputime64(const u64 jif) +{ + cputime_t ct; + u64 sec; + + /* have to be a little careful about overflow */ + ct = jif % HZ; + sec = jif / HZ; + if (ct) { + ct *= tb_ticks_per_sec; + do_div(ct, HZ); + } + if (sec) + ct += (cputime_t) sec * tb_ticks_per_sec; + return ct; +} + static inline u64 cputime64_to_jiffies64(const cputime_t ct) { return mulhdu(ct, __cputime_jiffies_factor);