diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/cputime.h | 8 | ||||
-rw-r--r-- | include/asm-generic/cputime_nsecs.h | 8 | ||||
-rw-r--r-- | include/linux/kernel_stat.h | 2 | ||||
-rw-r--r-- | include/linux/vtime.h | 16 |
4 files changed, 32 insertions, 2 deletions
diff --git a/include/asm-generic/cputime.h b/include/asm-generic/cputime.h index c6eddf50eaf9..51969436b8b8 100644 --- a/include/asm-generic/cputime.h +++ b/include/asm-generic/cputime.h | |||
@@ -4,6 +4,12 @@ | |||
4 | #include <linux/time.h> | 4 | #include <linux/time.h> |
5 | #include <linux/jiffies.h> | 5 | #include <linux/jiffies.h> |
6 | 6 | ||
7 | #include <asm-generic/cputime_jiffies.h> | 7 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING |
8 | # include <asm-generic/cputime_jiffies.h> | ||
9 | #endif | ||
10 | |||
11 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN | ||
12 | # include <asm-generic/cputime_nsecs.h> | ||
13 | #endif | ||
8 | 14 | ||
9 | #endif | 15 | #endif |
diff --git a/include/asm-generic/cputime_nsecs.h b/include/asm-generic/cputime_nsecs.h index c73d182f4751..b6485cafb7bd 100644 --- a/include/asm-generic/cputime_nsecs.h +++ b/include/asm-generic/cputime_nsecs.h | |||
@@ -26,6 +26,7 @@ typedef u64 __nocast cputime64_t; | |||
26 | */ | 26 | */ |
27 | #define cputime_to_jiffies(__ct) \ | 27 | #define cputime_to_jiffies(__ct) \ |
28 | ((__force u64)(__ct) / (NSEC_PER_SEC / HZ)) | 28 | ((__force u64)(__ct) / (NSEC_PER_SEC / HZ)) |
29 | #define cputime_to_scaled(__ct) (__ct) | ||
29 | #define jiffies_to_cputime(__jif) \ | 30 | #define jiffies_to_cputime(__jif) \ |
30 | (__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ)) | 31 | (__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ)) |
31 | #define cputime64_to_jiffies64(__ct) \ | 32 | #define cputime64_to_jiffies64(__ct) \ |
@@ -33,6 +34,13 @@ typedef u64 __nocast cputime64_t; | |||
33 | #define jiffies64_to_cputime64(__jif) \ | 34 | #define jiffies64_to_cputime64(__jif) \ |
34 | (__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ)) | 35 | (__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ)) |
35 | 36 | ||
37 | |||
38 | /* | ||
39 | * Convert cputime <-> nanoseconds | ||
40 | */ | ||
41 | #define nsecs_to_cputime(__nsecs) ((__force u64)(__nsecs)) | ||
42 | |||
43 | |||
36 | /* | 44 | /* |
37 | * Convert cputime <-> microseconds | 45 | * Convert cputime <-> microseconds |
38 | */ | 46 | */ |
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index 66b70780e910..ed5f6ed6eb77 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h | |||
@@ -127,7 +127,7 @@ extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t) | |||
127 | extern void account_steal_time(cputime_t); | 127 | extern void account_steal_time(cputime_t); |
128 | extern void account_idle_time(cputime_t); | 128 | extern void account_idle_time(cputime_t); |
129 | 129 | ||
130 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | 130 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE |
131 | static inline void account_process_tick(struct task_struct *tsk, int user) | 131 | static inline void account_process_tick(struct task_struct *tsk, int user) |
132 | { | 132 | { |
133 | vtime_account_user(tsk); | 133 | vtime_account_user(tsk); |
diff --git a/include/linux/vtime.h b/include/linux/vtime.h index ae30ab58431a..21ef703d1b25 100644 --- a/include/linux/vtime.h +++ b/include/linux/vtime.h | |||
@@ -14,9 +14,25 @@ extern void vtime_account(struct task_struct *tsk); | |||
14 | static inline void vtime_task_switch(struct task_struct *prev) { } | 14 | static inline void vtime_task_switch(struct task_struct *prev) { } |
15 | static inline void vtime_account_system(struct task_struct *tsk) { } | 15 | static inline void vtime_account_system(struct task_struct *tsk) { } |
16 | static inline void vtime_account_system_irqsafe(struct task_struct *tsk) { } | 16 | static inline void vtime_account_system_irqsafe(struct task_struct *tsk) { } |
17 | static inline void vtime_account_user(struct task_struct *tsk) { } | ||
17 | static inline void vtime_account(struct task_struct *tsk) { } | 18 | static inline void vtime_account(struct task_struct *tsk) { } |
18 | #endif | 19 | #endif |
19 | 20 | ||
21 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN | ||
22 | static inline void arch_vtime_task_switch(struct task_struct *tsk) { } | ||
23 | static inline void vtime_user_enter(struct task_struct *tsk) | ||
24 | { | ||
25 | vtime_account_system(tsk); | ||
26 | } | ||
27 | static inline void vtime_user_exit(struct task_struct *tsk) | ||
28 | { | ||
29 | vtime_account_user(tsk); | ||
30 | } | ||
31 | #else | ||
32 | static inline void vtime_user_enter(struct task_struct *tsk) { } | ||
33 | static inline void vtime_user_exit(struct task_struct *tsk) { } | ||
34 | #endif | ||
35 | |||
20 | #ifdef CONFIG_IRQ_TIME_ACCOUNTING | 36 | #ifdef CONFIG_IRQ_TIME_ACCOUNTING |
21 | extern void irqtime_account_irq(struct task_struct *tsk); | 37 | extern void irqtime_account_irq(struct task_struct *tsk); |
22 | #else | 38 | #else |