diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/cputime.h | 1 | ||||
-rw-r--r-- | include/asm-powerpc/cputime.h | 14 | ||||
-rw-r--r-- | include/asm-powerpc/paca.h | 2 | ||||
-rw-r--r-- | include/asm-s390/cputime.h | 1 |
4 files changed, 16 insertions, 2 deletions
diff --git a/include/asm-generic/cputime.h b/include/asm-generic/cputime.h index 09204e40d663..1c1fa422d18a 100644 --- a/include/asm-generic/cputime.h +++ b/include/asm-generic/cputime.h | |||
@@ -18,6 +18,7 @@ typedef unsigned long cputime_t; | |||
18 | #define cputime_lt(__a, __b) ((__a) < (__b)) | 18 | #define cputime_lt(__a, __b) ((__a) < (__b)) |
19 | #define cputime_le(__a, __b) ((__a) <= (__b)) | 19 | #define cputime_le(__a, __b) ((__a) <= (__b)) |
20 | #define cputime_to_jiffies(__ct) (__ct) | 20 | #define cputime_to_jiffies(__ct) (__ct) |
21 | #define cputime_to_scaled(__ct) (__ct) | ||
21 | #define jiffies_to_cputime(__hz) (__hz) | 22 | #define jiffies_to_cputime(__hz) (__hz) |
22 | 23 | ||
23 | typedef u64 cputime64_t; | 24 | typedef u64 cputime64_t; |
diff --git a/include/asm-powerpc/cputime.h b/include/asm-powerpc/cputime.h index 310804485208..f42e623030ee 100644 --- a/include/asm-powerpc/cputime.h +++ b/include/asm-powerpc/cputime.h | |||
@@ -52,12 +52,26 @@ typedef u64 cputime64_t; | |||
52 | * Convert cputime <-> jiffies | 52 | * Convert cputime <-> jiffies |
53 | */ | 53 | */ |
54 | extern u64 __cputime_jiffies_factor; | 54 | extern u64 __cputime_jiffies_factor; |
55 | DECLARE_PER_CPU(unsigned long, cputime_last_delta); | ||
56 | DECLARE_PER_CPU(unsigned long, cputime_scaled_last_delta); | ||
55 | 57 | ||
56 | static inline unsigned long cputime_to_jiffies(const cputime_t ct) | 58 | static inline unsigned long cputime_to_jiffies(const cputime_t ct) |
57 | { | 59 | { |
58 | return mulhdu(ct, __cputime_jiffies_factor); | 60 | return mulhdu(ct, __cputime_jiffies_factor); |
59 | } | 61 | } |
60 | 62 | ||
63 | /* Estimate the scaled cputime by scaling the real cputime based on | ||
64 | * the last scaled to real ratio */ | ||
65 | static inline cputime_t cputime_to_scaled(const cputime_t ct) | ||
66 | { | ||
67 | if (cpu_has_feature(CPU_FTR_SPURR) && | ||
68 | per_cpu(cputime_last_delta, smp_processor_id())) | ||
69 | return ct * | ||
70 | per_cpu(cputime_scaled_last_delta, smp_processor_id())/ | ||
71 | per_cpu(cputime_last_delta, smp_processor_id()); | ||
72 | return ct; | ||
73 | } | ||
74 | |||
61 | static inline cputime_t jiffies_to_cputime(const unsigned long jif) | 75 | static inline cputime_t jiffies_to_cputime(const unsigned long jif) |
62 | { | 76 | { |
63 | cputime_t ct; | 77 | cputime_t ct; |
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h index f6dfce025adf..748b35ab37b5 100644 --- a/include/asm-powerpc/paca.h +++ b/include/asm-powerpc/paca.h | |||
@@ -115,8 +115,6 @@ struct paca_struct { | |||
115 | u64 system_time; /* accumulated system TB ticks */ | 115 | u64 system_time; /* accumulated system TB ticks */ |
116 | u64 startpurr; /* PURR/TB value snapshot */ | 116 | u64 startpurr; /* PURR/TB value snapshot */ |
117 | u64 startspurr; /* SPURR value snapshot */ | 117 | u64 startspurr; /* SPURR value snapshot */ |
118 | u64 purrdelta; /* FIXME: document */ | ||
119 | u64 spurrdelta; /* FIXME: document */ | ||
120 | }; | 118 | }; |
121 | 119 | ||
122 | extern struct paca_struct paca[]; | 120 | extern struct paca_struct paca[]; |
diff --git a/include/asm-s390/cputime.h b/include/asm-s390/cputime.h index 4b3ef7cad115..133ce054fc89 100644 --- a/include/asm-s390/cputime.h +++ b/include/asm-s390/cputime.h | |||
@@ -54,6 +54,7 @@ __div(unsigned long long n, unsigned int base) | |||
54 | #define cputime_lt(__a, __b) ((__a) < (__b)) | 54 | #define cputime_lt(__a, __b) ((__a) < (__b)) |
55 | #define cputime_le(__a, __b) ((__a) <= (__b)) | 55 | #define cputime_le(__a, __b) ((__a) <= (__b)) |
56 | #define cputime_to_jiffies(__ct) (__div((__ct), 1000000 / HZ)) | 56 | #define cputime_to_jiffies(__ct) (__div((__ct), 1000000 / HZ)) |
57 | #define cputime_to_scaled(__ct) (__ct) | ||
57 | #define jiffies_to_cputime(__hz) ((cputime_t)(__hz) * (1000000 / HZ)) | 58 | #define jiffies_to_cputime(__hz) ((cputime_t)(__hz) * (1000000 / HZ)) |
58 | 59 | ||
59 | #define cputime64_zero (0ULL) | 60 | #define cputime64_zero (0ULL) |