aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Chen <kenchen@google.com>2008-12-16 01:04:15 -0500
committerIngo Molnar <mingo@elte.hu>2008-12-16 06:15:01 -0500
commite9515c3c9feecd74174c2998add0db51e02abb8d (patch)
tree961e5fc9f0d01a901fd28c548b8f39037611a4ce
parent720f54988e17b33f3f477010b3a68ee872d20d5a (diff)
sched, cpuacct: export percpu cpuacct cgroup stats
This patch export per-cpu CPU cycle usage for a given cpuacct cgroup. There is a need for a user space monitor daemon to track group CPU usage on per-cpu base. It is also useful for monitoring CFS load balancer behavior by tracking per CPU group usage. Signed-off-by: Ken Chen <kenchen@google.com> Reviewed-by: Li Zefan <lizf@cn.fujitsu.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--kernel/sched.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 41b7e2d524d..f53e2b8ef52 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -9342,12 +9342,32 @@ out:
9342 return err; 9342 return err;
9343} 9343}
9344 9344
9345static int cpuacct_percpu_seq_read(struct cgroup *cgroup, struct cftype *cft,
9346 struct seq_file *m)
9347{
9348 struct cpuacct *ca = cgroup_ca(cgroup);
9349 u64 percpu;
9350 int i;
9351
9352 for_each_present_cpu(i) {
9353 percpu = cpuacct_cpuusage_read(ca, i);
9354 seq_printf(m, "%llu ", (unsigned long long) percpu);
9355 }
9356 seq_printf(m, "\n");
9357 return 0;
9358}
9359
9345static struct cftype files[] = { 9360static struct cftype files[] = {
9346 { 9361 {
9347 .name = "usage", 9362 .name = "usage",
9348 .read_u64 = cpuusage_read, 9363 .read_u64 = cpuusage_read,
9349 .write_u64 = cpuusage_write, 9364 .write_u64 = cpuusage_write,
9350 }, 9365 },
9366 {
9367 .name = "usage_percpu",
9368 .read_seq_string = cpuacct_percpu_seq_read,
9369 },
9370
9351}; 9371};
9352 9372
9353static int cpuacct_populate(struct cgroup_subsys *ss, struct cgroup *cgrp) 9373static int cpuacct_populate(struct cgroup_subsys *ss, struct cgroup *cgrp)