alistair23-linux/include/linux/cgroup_subsys.h
Stephane Eranian e5d1367f17 perf: Add cgroup support
This kernel patch adds the ability to filter monitoring based on
container groups (cgroups). This is for use in per-cpu mode only.

The cgroup to monitor is passed as a file descriptor in the pid
argument to the syscall. The file descriptor must be opened to
the cgroup name in the cgroup filesystem. For instance, if the
cgroup name is foo and cgroupfs is mounted in /cgroup, then the
file descriptor is opened to /cgroup/foo. Cgroup mode is
activated by passing PERF_FLAG_PID_CGROUP in the flags argument
to the syscall.

For instance to measure in cgroup foo on CPU1 assuming
cgroupfs is mounted under /cgroup:

struct perf_event_attr attr;
int cgroup_fd, fd;

cgroup_fd = open("/cgroup/foo", O_RDONLY);
fd = perf_event_open(&attr, cgroup_fd, 1, -1, PERF_FLAG_PID_CGROUP);
close(cgroup_fd);

Signed-off-by: Stephane Eranian <eranian@google.com>
[ added perf_cgroup_{exit,attach} ]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <4d590250.114ddf0a.689e.4482@mx.google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2011-02-16 13:30:48 +01:00

73 lines
798 B
C

/* Add subsystem definitions of the form SUBSYS(<name>) in this
* file. Surround each one by a line of comment markers so that
* patches don't collide
*/
/* */
/* */
#ifdef CONFIG_CPUSETS
SUBSYS(cpuset)
#endif
/* */
#ifdef CONFIG_CGROUP_DEBUG
SUBSYS(debug)
#endif
/* */
#ifdef CONFIG_CGROUP_NS
SUBSYS(ns)
#endif
/* */
#ifdef CONFIG_CGROUP_SCHED
SUBSYS(cpu_cgroup)
#endif
/* */
#ifdef CONFIG_CGROUP_CPUACCT
SUBSYS(cpuacct)
#endif
/* */
#ifdef CONFIG_CGROUP_MEM_RES_CTLR
SUBSYS(mem_cgroup)
#endif
/* */
#ifdef CONFIG_CGROUP_DEVICE
SUBSYS(devices)
#endif
/* */
#ifdef CONFIG_CGROUP_FREEZER
SUBSYS(freezer)
#endif
/* */
#ifdef CONFIG_NET_CLS_CGROUP
SUBSYS(net_cls)
#endif
/* */
#ifdef CONFIG_BLK_CGROUP
SUBSYS(blkio)
#endif
#ifdef CONFIG_CGROUP_PERF
SUBSYS(perf)
#endif
/* */