diff options
Diffstat (limited to 'include/linux/delayacct.h')
-rw-r--r-- | include/linux/delayacct.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h new file mode 100644 index 000000000000..9572cfa1f129 --- /dev/null +++ b/include/linux/delayacct.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* delayacct.h - per-task delay accounting | ||
2 | * | ||
3 | * Copyright (C) Shailabh Nagar, IBM Corp. 2006 | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | ||
13 | * the GNU General Public License for more details. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #ifndef _LINUX_DELAYACCT_H | ||
18 | #define _LINUX_DELAYACCT_H | ||
19 | |||
20 | #include <linux/sched.h> | ||
21 | |||
22 | #ifdef CONFIG_TASK_DELAY_ACCT | ||
23 | |||
24 | extern int delayacct_on; /* Delay accounting turned on/off */ | ||
25 | extern kmem_cache_t *delayacct_cache; | ||
26 | extern void delayacct_init(void); | ||
27 | extern void __delayacct_tsk_init(struct task_struct *); | ||
28 | extern void __delayacct_tsk_exit(struct task_struct *); | ||
29 | |||
30 | static inline void delayacct_set_flag(int flag) | ||
31 | { | ||
32 | if (current->delays) | ||
33 | current->delays->flags |= flag; | ||
34 | } | ||
35 | |||
36 | static inline void delayacct_clear_flag(int flag) | ||
37 | { | ||
38 | if (current->delays) | ||
39 | current->delays->flags &= ~flag; | ||
40 | } | ||
41 | |||
42 | static inline void delayacct_tsk_init(struct task_struct *tsk) | ||
43 | { | ||
44 | /* reinitialize in case parent's non-null pointer was dup'ed*/ | ||
45 | tsk->delays = NULL; | ||
46 | if (unlikely(delayacct_on)) | ||
47 | __delayacct_tsk_init(tsk); | ||
48 | } | ||
49 | |||
50 | static inline void delayacct_tsk_exit(struct task_struct *tsk) | ||
51 | { | ||
52 | if (tsk->delays) | ||
53 | __delayacct_tsk_exit(tsk); | ||
54 | } | ||
55 | |||
56 | #else | ||
57 | static inline void delayacct_set_flag(int flag) | ||
58 | {} | ||
59 | static inline void delayacct_clear_flag(int flag) | ||
60 | {} | ||
61 | static inline void delayacct_init(void) | ||
62 | {} | ||
63 | static inline void delayacct_tsk_init(struct task_struct *tsk) | ||
64 | {} | ||
65 | static inline void delayacct_tsk_exit(struct task_struct *tsk) | ||
66 | {} | ||
67 | #endif /* CONFIG_TASK_DELAY_ACCT */ | ||
68 | |||
69 | #endif | ||