summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJay Lan <jlan@engr.sgi.com>2006-09-30 23:28:58 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-01 00:39:29 -0700
commit9acc1853519a0473620d424105f9d49ea5b4e62e (patch)
treefd4d03bf82ea604e71f8e805e557023226c2dd42 /kernel
parentf3cef7a99469afc159fec3a61b42dc7ca5b6824f (diff)
downloadlinux-9acc1853519a0473620d424105f9d49ea5b4e62e.tar.bz2
[PATCH] csa: Extended system accounting over taskstats
Add extended system accounting handling over taskstats interface. A CONFIG_TASK_XACCT flag is created to enable the extended accounting code. 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> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/taskstats.c4
-rw-r--r--kernel/tsacct.c19
2 files changed, 23 insertions, 0 deletions
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index 6c38dce88e8c..5d6a8c54ee85 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -20,6 +20,7 @@
#include <linux/taskstats_kern.h>
#include <linux/tsacct_kern.h>
#include <linux/delayacct.h>
+#include <linux/tsacct_kern.h>
#include <linux/cpumask.h>
#include <linux/percpu.h>
#include <net/genetlink.h>
@@ -204,6 +205,9 @@ static int fill_pid(pid_t pid, struct task_struct *pidtsk,
stats->version = TASKSTATS_VERSION;
bacct_add_tsk(stats, tsk);
+ /* fill in extended acct fields */
+ xacct_add_tsk(stats, tsk);
+
/* Define err: label here if needed */
put_task_struct(tsk);
return rc;
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index 899067950a88..410483490cf6 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -70,3 +70,22 @@ void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
strncpy(stats->ac_comm, tsk->comm, sizeof(stats->ac_comm));
}
+
+#ifdef CONFIG_TASK_XACCT
+/*
+ * fill in extended accounting fields
+ */
+void xacct_add_tsk(struct taskstats *stats, struct task_struct *p)
+{
+ stats->acct_rss_mem1 = p->acct_rss_mem1;
+ stats->acct_vm_mem1 = p->acct_vm_mem1;
+ if (p->mm) {
+ stats->hiwater_rss = p->mm->hiwater_rss;
+ stats->hiwater_vm = p->mm->hiwater_vm;
+ }
+ stats->read_char = p->rchar;
+ stats->write_char = p->wchar;
+ stats->read_syscalls = p->syscr;
+ stats->write_syscalls = p->syscw;
+}
+#endif