aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/delayacct.h
diff options
context:
space:
mode:
authorShailabh Nagar <nagar@watson.ibm.com>2006-07-14 03:24:36 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-15 00:53:56 -0400
commitca74e92b4698276b6696f15a801759f50944f387 (patch)
tree26f0de66d8207608e07ee22389bfc173e773c0c2 /include/linux/delayacct.h
parente8f4d97e1b58b50ad6449bb2d35e6632c0236abd (diff)
[PATCH] per-task-delay-accounting: setup
Initialization code related to collection of per-task "delay" statistics which measure how long it had to wait for cpu, sync block io, swapping etc. The collection of statistics and the interface are in other patches. This patch sets up the data structures and allows the statistics collection to be disabled through a kernel boot parameter. Signed-off-by: Shailabh Nagar <nagar@watson.ibm.com> Signed-off-by: Balbir Singh <balbir@in.ibm.com> Cc: Jes Sorensen <jes@sgi.com> Cc: Peter Chubb <peterc@gelato.unsw.edu.au> Cc: Erich Focht <efocht@ess.nec.de> Cc: Levent Serinol <lserinol@gmail.com> Cc: Jay Lan <jlan@engr.sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/delayacct.h')
-rw-r--r--include/linux/delayacct.h69
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
24extern int delayacct_on; /* Delay accounting turned on/off */
25extern kmem_cache_t *delayacct_cache;
26extern void delayacct_init(void);
27extern void __delayacct_tsk_init(struct task_struct *);
28extern void __delayacct_tsk_exit(struct task_struct *);
29
30static inline void delayacct_set_flag(int flag)
31{
32 if (current->delays)
33 current->delays->flags |= flag;
34}
35
36static inline void delayacct_clear_flag(int flag)
37{
38 if (current->delays)
39 current->delays->flags &= ~flag;
40}
41
42static 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
50static inline void delayacct_tsk_exit(struct task_struct *tsk)
51{
52 if (tsk->delays)
53 __delayacct_tsk_exit(tsk);
54}
55
56#else
57static inline void delayacct_set_flag(int flag)
58{}
59static inline void delayacct_clear_flag(int flag)
60{}
61static inline void delayacct_init(void)
62{}
63static inline void delayacct_tsk_init(struct task_struct *tsk)
64{}
65static inline void delayacct_tsk_exit(struct task_struct *tsk)
66{}
67#endif /* CONFIG_TASK_DELAY_ACCT */
68
69#endif