blob: fc9da2e26443911d266883924da1499d73713e4a [file] [log] [blame]
Shailabh Nagarc7572492006-07-14 00:24:40 -07001/* taskstats_kern.h - kernel header for per-task statistics interface
2 *
3 * Copyright (C) Shailabh Nagar, IBM Corp. 2006
4 * (C) Balbir Singh, IBM Corp. 2006
5 */
6
7#ifndef _LINUX_TASKSTATS_KERN_H
8#define _LINUX_TASKSTATS_KERN_H
9
10#include <linux/taskstats.h>
11#include <linux/sched.h>
12
13enum {
14 TASKSTATS_MSG_UNICAST, /* send data only to requester */
15 TASKSTATS_MSG_MULTICAST, /* send data to a group */
16};
17
18#ifdef CONFIG_TASKSTATS
19extern kmem_cache_t *taskstats_cache;
Shailabh Nagar6f449932006-07-14 00:24:41 -070020extern struct mutex taskstats_exit_mutex;
Shailabh Nagarc7572492006-07-14 00:24:40 -070021
22static inline void taskstats_exit_alloc(struct taskstats **ptidstats,
23 struct taskstats **ptgidstats)
24{
25 *ptidstats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL);
26 *ptgidstats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL);
27}
28
29static inline void taskstats_exit_free(struct taskstats *tidstats,
30 struct taskstats *tgidstats)
31{
32 if (tidstats)
33 kmem_cache_free(taskstats_cache, tidstats);
34 if (tgidstats)
35 kmem_cache_free(taskstats_cache, tgidstats);
36}
37
38extern void taskstats_exit_send(struct task_struct *, struct taskstats *,
39 struct taskstats *);
40extern void taskstats_init_early(void);
41
42#else
43static inline void taskstats_exit_alloc(struct taskstats **ptidstats,
44 struct taskstats **ptgidstats)
45{}
46static inline void taskstats_exit_free(struct taskstats *ptidstats,
47 struct taskstats *ptgidstats)
48{}
49static inline void taskstats_exit_send(struct task_struct *tsk,
50 struct taskstats *tidstats,
51 struct taskstats *tgidstats)
52{}
53static inline void taskstats_init_early(void)
54{}
55#endif /* CONFIG_TASKSTATS */
56
57#endif
58