Commit e9515c3c authored by Ken Chen's avatar Ken Chen Committed by Ingo Molnar

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: default avatarKen Chen <kenchen@google.com>
Reviewed-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 720f5498
...@@ -9342,12 +9342,32 @@ static int cpuusage_write(struct cgroup *cgrp, struct cftype *cftype, ...@@ -9342,12 +9342,32 @@ static int cpuusage_write(struct cgroup *cgrp, struct cftype *cftype,
return err; return err;
} }
static int cpuacct_percpu_seq_read(struct cgroup *cgroup, struct cftype *cft,
struct seq_file *m)
{
struct cpuacct *ca = cgroup_ca(cgroup);
u64 percpu;
int i;
for_each_present_cpu(i) {
percpu = cpuacct_cpuusage_read(ca, i);
seq_printf(m, "%llu ", (unsigned long long) percpu);
}
seq_printf(m, "\n");
return 0;
}
static struct cftype files[] = { static struct cftype files[] = {
{ {
.name = "usage", .name = "usage",
.read_u64 = cpuusage_read, .read_u64 = cpuusage_read,
.write_u64 = cpuusage_write, .write_u64 = cpuusage_write,
}, },
{
.name = "usage_percpu",
.read_seq_string = cpuacct_percpu_seq_read,
},
}; };
static int cpuacct_populate(struct cgroup_subsys *ss, struct cgroup *cgrp) static int cpuacct_populate(struct cgroup_subsys *ss, struct cgroup *cgrp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment