]> git.baikalelectronics.ru Git - kernel.git/commit
perf script python: Allow reporting the [un]throttle PERF_RECORD_ meta event
authorStephen Brennan <stephen.s.brennan@oracle.com>
Wed, 1 Sep 2021 21:08:15 +0000 (14:08 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 3 Sep 2021 11:18:25 +0000 (08:18 -0300)
commitccd865c1e102f7657487cb8236d7baf0336b3f0f
treee31af05ff0956814298c11ed89c6263966805237
parentd8b45ee3c67476702c7e7e7cab551aba0d93ef8b
perf script python: Allow reporting the [un]throttle PERF_RECORD_ meta event

perf_events may sometimes throttle an event due to creating too many
samples during a given timer tick.

As of now, the perf tool will not report on throttling, which means this
is a silent error.

Implement a callback for the throttle and unthrottle events within the
Python scripting engine, which can allow scripts to detect and report
when events may have been lost due to throttling.

The simplest script to report throttle events is:

  def throttle(*args):
      print("throttle" + repr(args))

  def unthrottle(*args):
      print("unthrottle" + repr(args))

Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20210901210815.133251-1-stephen.s.brennan@oracle.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-script.c
tools/perf/util/scripting-engines/trace-event-python.c
tools/perf/util/trace-event.h