]> git.itanic.dy.fi Git - linux-stable/commit
perf bench sched pipe: Add -G/--cgroups option
authorNamhyung Kim <namhyung@kernel.org>
Tue, 17 Oct 2023 20:23:42 +0000 (13:23 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 25 Oct 2023 17:02:10 +0000 (10:02 -0700)
commit79a3371bdf453bedb9d2c80df5adc201dddc11b5
tree228ce691d416ee3d4fb25426fecae34dbb5e4d0e
parentcbf5f58461b25f3f3e19704e2e51ad002c11080c
perf bench sched pipe: Add -G/--cgroups option

The -G/--cgroups option is to put sender and receiver in different
cgroups in order to measure cgroup context switch overheads.

Users need to make sure the cgroups exist and accessible.  The following
example should the effect of this change.  Please don't forget taskset
before the perf bench to measure cgroup switches properly.  Otherwise
each task would run on a different CPU and generate cgroup switches
regardless of this change.

  # perf stat -e context-switches,cgroup-switches \
  > taskset -c 0 perf bench sched pipe -l 10000 > /dev/null

   Performance counter stats for 'taskset -c 0 perf bench sched pipe -l 10000':

              20,001      context-switches
                   2      cgroup-switches

         0.053449651 seconds time elapsed

         0.011286000 seconds user
         0.041869000 seconds sys

  # perf stat -e context-switches,cgroup-switches \
  > taskset -c 0 perf bench sched pipe -l 10000 -G AAA,BBB > /dev/null

   Performance counter stats for 'taskset -c 0 perf bench sched pipe -l 10000 -G AAA,BBB':

              20,001      context-switches
              20,001      cgroup-switches

         0.052768627 seconds time elapsed

         0.006284000 seconds user
         0.046266000 seconds sys

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: https://lore.kernel.org/r/20231017202342.1353124-1-namhyung@kernel.org
tools/perf/Documentation/perf-bench.txt
tools/perf/bench/sched-pipe.c