Blame view
include/linux/vtime.h
3.66 KB
dcbf832e5
|
1 2 |
#ifndef _LINUX_KERNEL_VTIME_H #define _LINUX_KERNEL_VTIME_H |
b04934061
|
3 |
#include <linux/context_tracking_state.h> |
a5725ac23
|
4 5 6 |
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE #include <asm/vtime.h> #endif |
b04934061
|
7 |
|
dcbf832e5
|
8 |
struct task_struct; |
b04934061
|
9 10 11 12 13 14 15 16 17 18 |
/* * vtime_accounting_enabled() definitions/declarations */ #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE static inline bool vtime_accounting_enabled(void) { return true; } #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN static inline bool vtime_accounting_enabled(void) { |
58135f574
|
19 |
if (context_tracking_is_enabled()) { |
d0df09ebf
|
20 |
if (context_tracking_cpu_is_enabled()) |
b04934061
|
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
return true; } return false; } #endif /* CONFIG_VIRT_CPU_ACCOUNTING_GEN */ #ifndef CONFIG_VIRT_CPU_ACCOUNTING static inline bool vtime_accounting_enabled(void) { return false; } #endif /* !CONFIG_VIRT_CPU_ACCOUNTING */ /* * Common vtime APIs */ |
dcbf832e5
|
36 |
#ifdef CONFIG_VIRT_CPU_ACCOUNTING |
b04934061
|
37 38 |
#ifdef __ARCH_HAS_VTIME_TASK_SWITCH |
dcbf832e5
|
39 |
extern void vtime_task_switch(struct task_struct *prev); |
b04934061
|
40 41 42 43 44 45 46 47 |
#else extern void vtime_common_task_switch(struct task_struct *prev); static inline void vtime_task_switch(struct task_struct *prev) { if (vtime_accounting_enabled()) vtime_common_task_switch(prev); } #endif /* __ARCH_HAS_VTIME_TASK_SWITCH */ |
dcbf832e5
|
48 |
extern void vtime_account_system(struct task_struct *tsk); |
fd25b4c2f
|
49 |
extern void vtime_account_idle(struct task_struct *tsk); |
bcebdf846
|
50 |
extern void vtime_account_user(struct task_struct *tsk); |
3f4724ea8
|
51 |
|
b04934061
|
52 53 54 55 56 57 58 59 60 61 |
#ifdef __ARCH_HAS_VTIME_ACCOUNT extern void vtime_account_irq_enter(struct task_struct *tsk); #else extern void vtime_common_account_irq_enter(struct task_struct *tsk); static inline void vtime_account_irq_enter(struct task_struct *tsk) { if (vtime_accounting_enabled()) vtime_common_account_irq_enter(tsk); } #endif /* __ARCH_HAS_VTIME_ACCOUNT */ |
3f4724ea8
|
62 63 |
#else /* !CONFIG_VIRT_CPU_ACCOUNTING */ |
6a61671bb
|
64 |
|
dcbf832e5
|
65 |
static inline void vtime_task_switch(struct task_struct *prev) { } |
11113334d
|
66 |
static inline void vtime_account_system(struct task_struct *tsk) { } |
abf917cd9
|
67 |
static inline void vtime_account_user(struct task_struct *tsk) { } |
6a61671bb
|
68 |
static inline void vtime_account_irq_enter(struct task_struct *tsk) { } |
b04934061
|
69 |
#endif /* !CONFIG_VIRT_CPU_ACCOUNTING */ |
abf917cd9
|
70 71 |
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN |
6a61671bb
|
72 |
extern void arch_vtime_task_switch(struct task_struct *tsk); |
b04934061
|
73 74 75 76 77 78 79 |
extern void vtime_gen_account_irq_exit(struct task_struct *tsk); static inline void vtime_account_irq_exit(struct task_struct *tsk) { if (vtime_accounting_enabled()) vtime_gen_account_irq_exit(tsk); } |
6a61671bb
|
80 |
extern void vtime_user_enter(struct task_struct *tsk); |
b04934061
|
81 |
|
abf917cd9
|
82 83 84 85 |
static inline void vtime_user_exit(struct task_struct *tsk) { vtime_account_user(tsk); } |
6a61671bb
|
86 87 |
extern void vtime_guest_enter(struct task_struct *tsk); extern void vtime_guest_exit(struct task_struct *tsk); |
45eacc692
|
88 |
extern void vtime_init_idle(struct task_struct *tsk, int cpu); |
b04934061
|
89 |
#else /* !CONFIG_VIRT_CPU_ACCOUNTING_GEN */ |
6a61671bb
|
90 91 92 93 94 |
static inline void vtime_account_irq_exit(struct task_struct *tsk) { /* On hard|softirq exit we always account to hard|softirq cputime */ vtime_account_system(tsk); } |
abf917cd9
|
95 96 |
static inline void vtime_user_enter(struct task_struct *tsk) { } static inline void vtime_user_exit(struct task_struct *tsk) { } |
6a61671bb
|
97 98 |
static inline void vtime_guest_enter(struct task_struct *tsk) { } static inline void vtime_guest_exit(struct task_struct *tsk) { } |
45eacc692
|
99 |
static inline void vtime_init_idle(struct task_struct *tsk, int cpu) { } |
dcbf832e5
|
100 |
#endif |
3e1df4f50
|
101 102 |
#ifdef CONFIG_IRQ_TIME_ACCOUNTING extern void irqtime_account_irq(struct task_struct *tsk); |
dcbf832e5
|
103 |
#else |
3e1df4f50
|
104 |
static inline void irqtime_account_irq(struct task_struct *tsk) { } |
dcbf832e5
|
105 |
#endif |
6a61671bb
|
106 |
static inline void account_irq_enter_time(struct task_struct *tsk) |
fa5058f3b
|
107 |
{ |
6a61671bb
|
108 |
vtime_account_irq_enter(tsk); |
3e1df4f50
|
109 |
irqtime_account_irq(tsk); |
fa5058f3b
|
110 |
} |
6a61671bb
|
111 |
static inline void account_irq_exit_time(struct task_struct *tsk) |
fa5058f3b
|
112 |
{ |
6a61671bb
|
113 |
vtime_account_irq_exit(tsk); |
3e1df4f50
|
114 |
irqtime_account_irq(tsk); |
fa5058f3b
|
115 |
} |
dcbf832e5
|
116 |
#endif /* _LINUX_KERNEL_VTIME_H */ |