aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorPaul Menage <[email protected]>2007-10-18 23:39:42 -0700
committerLinus Torvalds <[email protected]>2007-10-19 11:53:36 -0700
commit62d0df64065e7c135d0002f069444fbdfc64768f (patch)
tree9087bf336182ab9c619460ba2370a223200179bc /include/linux
parent8793d854edbc2774943a4b0de3304dc73991159a (diff)
Task Control Groups: example CPU accounting subsystem
This example demonstrates how to use the generic cgroup subsystem for a simple resource tracker that counts, for the processes in a cgroup, the total CPU time used and the %CPU used in the last complete 10 second interval. Portions contributed by Balbir Singh <[email protected]> Signed-off-by: Paul Menage <[email protected]> Cc: Serge E. Hallyn <[email protected]> Cc: "Eric W. Biederman" <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Balbir Singh <[email protected]> Cc: Paul Jackson <[email protected]> Cc: Kirill Korotaev <[email protected]> Cc: Herbert Poetzl <[email protected]> Cc: Srivatsa Vaddagiri <[email protected]> Cc: Cedric Le Goater <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/cgroup_subsys.h6
-rw-r--r--include/linux/cpu_acct.h14
2 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index b152b51a4367..a568b8746f18 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -13,4 +13,10 @@ SUBSYS(cpuset)
/* */
+#ifdef CONFIG_CGROUP_CPUACCT
+SUBSYS(cpuacct)
+#endif
+
+/* */
+
/* */
diff --git a/include/linux/cpu_acct.h b/include/linux/cpu_acct.h
new file mode 100644
index 000000000000..6b5fd8a66c8d
--- /dev/null
+++ b/include/linux/cpu_acct.h
@@ -0,0 +1,14 @@
+
+#ifndef _LINUX_CPU_ACCT_H
+#define _LINUX_CPU_ACCT_H
+
+#include <linux/cgroup.h>
+#include <asm/cputime.h>
+
+#ifdef CONFIG_CGROUP_CPUACCT
+extern void cpuacct_charge(struct task_struct *, cputime_t cputime);
+#else
+static void inline cpuacct_charge(struct task_struct *p, cputime_t cputime) {}
+#endif
+
+#endif