OSDN Git Service

simpleperf: Support event_source bus event types
authorNamhyung Kim <namhyung@google.com>
Wed, 23 Oct 2019 03:37:34 +0000 (12:37 +0900)
committerNamhyung Kim <namhyung@google.com>
Fri, 20 Dec 2019 08:23:59 +0000 (17:23 +0900)
commit52ff4263e57843b44657815973950c980aad81e1
tree51ddd8d654791f8c1f778822072c3a2e18970458
parent72f8dd3e98083d3db3da295d59d14445bb4b3d7e
simpleperf: Support event_source bus event types

The perf_event subsystem exports available PMUs and their events under
/sys/bus/event_source/devices directory.  This patch supports those
events using 'pmu/event/' format like in the mainline perf tool.

The "event" part above might have multiple terms if supported by PMU.
In that case PMU would have "format" directory for available terms.
They would be seperated by comma, so the enclosing "/"s are needed to
group those terms for an event.

But currently all PMUs seem to support a single term only so I left
the parser to split events by comma and match the whole string
(including "/"s).

For example you can use cpu-cycles events like below:

  # simpleperf stat -a -e armv8_pmuv3/cpu_cycles/ sleep 1
  Performance counter statistics:

    986,481,766  armv8_pmuv3/cpu_cycles/   #   (100%)

  Total test time: 1.007272 seconds.

Test: build and run simpleperf_unit_test
Change-Id: Ibdf1180e58d190f8108cdc8d8a096e6323b2a6f3
simpleperf/cmd_record_test.cpp
simpleperf/cmd_stat_test.cpp
simpleperf/event_type.cpp
simpleperf/event_type.h
simpleperf/test_util.h