diff options
author | Shailabh Nagar <nagar@watson.ibm.com> | 2006-07-14 03:24:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-15 00:53:56 -0400 |
commit | c757249af152c59fd74b85e52e8c090acb33d9c0 (patch) | |
tree | 78495f661fe537bf5087b24e6577659de8725b5a /include/linux/taskstats.h | |
parent | fb0ba6bd021248b6bdc58a7b1213a55a6776a38a (diff) |
[PATCH] per-task-delay-accounting: taskstats interface
Create a "taskstats" interface based on generic netlink (NETLINK_GENERIC
family), for getting statistics of tasks and thread groups during their
lifetime and when they exit. The interface is intended for use by multiple
accounting packages though it is being created in the context of delay
accounting.
This patch creates the interface without populating the fields of the data
that is sent to the user in response to a command or upon the exit of a task.
Each accounting package interested in using taskstats has to provide an
additional patch to add its stats to the common structure.
[akpm@osdl.org: cleanups, Kconfig fix]
Signed-off-by: Shailabh Nagar <nagar@us.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/taskstats.h')
-rw-r--r-- | include/linux/taskstats.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/include/linux/taskstats.h b/include/linux/taskstats.h new file mode 100644 index 000000000000..51f62759bea9 --- /dev/null +++ b/include/linux/taskstats.h | |||
@@ -0,0 +1,84 @@ | |||
1 | /* taskstats.h - exporting per-task statistics | ||
2 | * | ||
3 | * Copyright (C) Shailabh Nagar, IBM Corp. 2006 | ||
4 | * (C) Balbir Singh, IBM Corp. 2006 | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of version 2.1 of the GNU Lesser General Public License | ||
8 | * as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it would be useful, but | ||
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | */ | ||
14 | |||
15 | #ifndef _LINUX_TASKSTATS_H | ||
16 | #define _LINUX_TASKSTATS_H | ||
17 | |||
18 | /* Format for per-task data returned to userland when | ||
19 | * - a task exits | ||
20 | * - listener requests stats for a task | ||
21 | * | ||
22 | * The struct is versioned. Newer versions should only add fields to | ||
23 | * the bottom of the struct to maintain backward compatibility. | ||
24 | * | ||
25 | * | ||
26 | * To add new fields | ||
27 | * a) bump up TASKSTATS_VERSION | ||
28 | * b) add comment indicating new version number at end of struct | ||
29 | * c) add new fields after version comment; maintain 64-bit alignment | ||
30 | */ | ||
31 | |||
32 | #define TASKSTATS_VERSION 1 | ||
33 | |||
34 | struct taskstats { | ||
35 | |||
36 | /* Version 1 */ | ||
37 | __u64 version; | ||
38 | }; | ||
39 | |||
40 | |||
41 | #define TASKSTATS_LISTEN_GROUP 0x1 | ||
42 | |||
43 | /* | ||
44 | * Commands sent from userspace | ||
45 | * Not versioned. New commands should only be inserted at the enum's end | ||
46 | * prior to __TASKSTATS_CMD_MAX | ||
47 | */ | ||
48 | |||
49 | enum { | ||
50 | TASKSTATS_CMD_UNSPEC = 0, /* Reserved */ | ||
51 | TASKSTATS_CMD_GET, /* user->kernel request/get-response */ | ||
52 | TASKSTATS_CMD_NEW, /* kernel->user event */ | ||
53 | __TASKSTATS_CMD_MAX, | ||
54 | }; | ||
55 | |||
56 | #define TASKSTATS_CMD_MAX (__TASKSTATS_CMD_MAX - 1) | ||
57 | |||
58 | enum { | ||
59 | TASKSTATS_TYPE_UNSPEC = 0, /* Reserved */ | ||
60 | TASKSTATS_TYPE_PID, /* Process id */ | ||
61 | TASKSTATS_TYPE_TGID, /* Thread group id */ | ||
62 | TASKSTATS_TYPE_STATS, /* taskstats structure */ | ||
63 | TASKSTATS_TYPE_AGGR_PID, /* contains pid + stats */ | ||
64 | TASKSTATS_TYPE_AGGR_TGID, /* contains tgid + stats */ | ||
65 | __TASKSTATS_TYPE_MAX, | ||
66 | }; | ||
67 | |||
68 | #define TASKSTATS_TYPE_MAX (__TASKSTATS_TYPE_MAX - 1) | ||
69 | |||
70 | enum { | ||
71 | TASKSTATS_CMD_ATTR_UNSPEC = 0, | ||
72 | TASKSTATS_CMD_ATTR_PID, | ||
73 | TASKSTATS_CMD_ATTR_TGID, | ||
74 | __TASKSTATS_CMD_ATTR_MAX, | ||
75 | }; | ||
76 | |||
77 | #define TASKSTATS_CMD_ATTR_MAX (__TASKSTATS_CMD_ATTR_MAX - 1) | ||
78 | |||
79 | /* NETLINK_GENERIC related info */ | ||
80 | |||
81 | #define TASKSTATS_GENL_NAME "TASKSTATS" | ||
82 | #define TASKSTATS_GENL_VERSION 0x1 | ||
83 | |||
84 | #endif /* _LINUX_TASKSTATS_H */ | ||