aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Lan <jlan@engr.sgi.com>2006-10-01 02:28:55 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-01 03:39:29 -0400
commitf3cef7a99469afc159fec3a61b42dc7ca5b6824f (patch)
treeb1805a0d0b4a273b8ce0a245c17570ff18abdc5b /include
parent7d1bdca9b06acb3df07329eaff72d5eaf1543287 (diff)
[PATCH] csa: basic accounting over taskstats
Add some basic accounting fields to the taskstats struct, add a new kernel/tsacct.c to handle basic accounting data handling upon exit. A handle is added to taskstats.c to invoke the basic accounting data handling. Signed-off-by: Jay Lan <jlan@sgi.com> Cc: Shailabh Nagar <nagar@watson.ibm.com> Cc: Balbir Singh <balbir@in.ibm.com> Cc: Jes Sorensen <jes@sgi.com> Cc: Chris Sturtivant <csturtiv@sgi.com> Cc: Tony Ernst <tee@sgi.com> Cc: Guillaume Thouvenin <guillaume.thouvenin@bull.net> Cc: "Michal Piotrowski" <michal.k.k.piotrowski@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/taskstats.h29
-rw-r--r--include/linux/tsacct_kern.h19
2 files changed, 43 insertions, 5 deletions
diff --git a/include/linux/taskstats.h b/include/linux/taskstats.h
index f1cb6cddd19d..af93a63a5092 100644
--- a/include/linux/taskstats.h
+++ b/include/linux/taskstats.h
@@ -2,6 +2,7 @@
2 * 2 *
3 * Copyright (C) Shailabh Nagar, IBM Corp. 2006 3 * Copyright (C) Shailabh Nagar, IBM Corp. 2006
4 * (C) Balbir Singh, IBM Corp. 2006 4 * (C) Balbir Singh, IBM Corp. 2006
5 * (C) Jay Lan, SGI, 2006
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify it 7 * 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 * under the terms of version 2.1 of the GNU Lesser General Public License
@@ -29,16 +30,18 @@
29 * c) add new fields after version comment; maintain 64-bit alignment 30 * c) add new fields after version comment; maintain 64-bit alignment
30 */ 31 */
31 32
32#define TASKSTATS_VERSION 1 33
34#define TASKSTATS_VERSION 2
35#define TS_COMM_LEN 16 /* should sync up with TASK_COMM_LEN
36 * in linux/sched.h */
33 37
34struct taskstats { 38struct taskstats {
35 39
36 /* Version 1 */ 40 /* Version 1 */
37 __u16 version; 41 __u16 version;
38 __u16 padding[3]; /* Userspace should not interpret the padding 42 __u32 ac_exitcode; /* Exit status */
39 * field which can be replaced by useful 43 __u8 ac_flag; /* Record flags */
40 * fields if struct taskstats is extended. 44 __u8 ac_nice; /* task_nice */
41 */
42 45
43 /* Delay accounting fields start 46 /* Delay accounting fields start
44 * 47 *
@@ -88,6 +91,22 @@ struct taskstats {
88 __u64 cpu_run_virtual_total; 91 __u64 cpu_run_virtual_total;
89 /* Delay accounting fields end */ 92 /* Delay accounting fields end */
90 /* version 1 ends here */ 93 /* version 1 ends here */
94
95 /* Basic Accounting Fields start */
96 char ac_comm[TS_COMM_LEN]; /* Command name */
97 __u8 ac_sched; /* Scheduling discipline */
98 __u8 ac_pad[3];
99 __u32 ac_uid; /* User ID */
100 __u32 ac_gid; /* Group ID */
101 __u32 ac_pid; /* Process ID */
102 __u32 ac_ppid; /* Parent process ID */
103 __u32 ac_btime; /* Begin time [sec since 1970] */
104 __u64 ac_etime; /* Elapsed time [usec] */
105 __u64 ac_utime; /* User CPU time [usec] */
106 __u64 ac_stime; /* SYstem CPU time [usec] */
107 __u64 ac_minflt; /* Minor Page Fault */
108 __u64 ac_majflt; /* Major Page Fault */
109 /* Basic Accounting Fields end */
91}; 110};
92 111
93 112
diff --git a/include/linux/tsacct_kern.h b/include/linux/tsacct_kern.h
new file mode 100644
index 000000000000..7e8196a02118
--- /dev/null
+++ b/include/linux/tsacct_kern.h
@@ -0,0 +1,19 @@
1/*
2 * tsacct_kern.h - kernel header for system accounting over taskstats interface
3 *
4 * Copyright (C) Jay Lan SGI
5 */
6
7#ifndef _LINUX_TSACCT_KERN_H
8#define _LINUX_TSACCT_KERN_H
9
10#include <linux/taskstats.h>
11
12#ifdef CONFIG_TASKSTATS
13extern void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk);
14#else
15static inline void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
16{}
17#endif /* CONFIG_TASKSTATS */
18
19#endif