I want to use --cgroup
options with perf to collect performance metrics within a container.
I created the cgroup in the following way:
<code>cgcreate -g cpu:/perf_test
cgcreate -g perf_event:/perf_test
cgexec -g "cpu:/perf_test" -g "perf_event:/perf_test" stress-ng --cpu 16 --timeout 1y
</code>
<code>cgcreate -g cpu:/perf_test
cgcreate -g perf_event:/perf_test
cgexec -g "cpu:/perf_test" -g "perf_event:/perf_test" stress-ng --cpu 16 --timeout 1y
</code>
cgcreate -g cpu:/perf_test
cgcreate -g perf_event:/perf_test
cgexec -g "cpu:/perf_test" -g "perf_event:/perf_test" stress-ng --cpu 16 --timeout 1y
I use perf in the following method, but it keeps failing:
<code># perf stat -e cycles,cpu-clock --cgroup=perf_test
Usage: perf stat [<options>] [<command>]
-a, --all-cpus system-wide collection from all CPUs
-A, --no-aggr disable CPU count aggregation
-B, --big-num print large numbers with thousands' separators
-C, --cpu <cpu> list of cpus to monitor in system-wide
-c, --scale scale/normalize counters
-D, --delay <n> ms to wait before starting measurement after program start
-d, --detailed detailed run - start a lot of events
-e, --event <event> event selector. use 'perf list' to list available events
-G, --cgroup <name> monitor event in cgroup name only
-g, --group put the counters into a counter group
-I, --interval-print <n>
print counts at regular interval in ms (>= 10)
-i, --no-inherit child tasks do not inherit counters
-n, --null null run - dont start any counters
</code>
<code># perf stat -e cycles,cpu-clock --cgroup=perf_test
Usage: perf stat [<options>] [<command>]
-a, --all-cpus system-wide collection from all CPUs
-A, --no-aggr disable CPU count aggregation
-B, --big-num print large numbers with thousands' separators
-C, --cpu <cpu> list of cpus to monitor in system-wide
-c, --scale scale/normalize counters
-D, --delay <n> ms to wait before starting measurement after program start
-d, --detailed detailed run - start a lot of events
-e, --event <event> event selector. use 'perf list' to list available events
-G, --cgroup <name> monitor event in cgroup name only
-g, --group put the counters into a counter group
-I, --interval-print <n>
print counts at regular interval in ms (>= 10)
-i, --no-inherit child tasks do not inherit counters
-n, --null null run - dont start any counters
</code>
# perf stat -e cycles,cpu-clock --cgroup=perf_test
Usage: perf stat [<options>] [<command>]
-a, --all-cpus system-wide collection from all CPUs
-A, --no-aggr disable CPU count aggregation
-B, --big-num print large numbers with thousands' separators
-C, --cpu <cpu> list of cpus to monitor in system-wide
-c, --scale scale/normalize counters
-D, --delay <n> ms to wait before starting measurement after program start
-d, --detailed detailed run - start a lot of events
-e, --event <event> event selector. use 'perf list' to list available events
-G, --cgroup <name> monitor event in cgroup name only
-g, --group put the counters into a counter group
-I, --interval-print <n>
print counts at regular interval in ms (>= 10)
-i, --no-inherit child tasks do not inherit counters
-n, --null null run - dont start any counters
What could be the reason?
The perf version is: perf version 3.10.0-693.5.2.el7.x86_64.debug
OS version is: CentOS Linux release 7.4.1708 (Core)
kernel version is: 4.18.0