Ian Rogers
1ba3752aec
perf pmu-events: Hide the pmu_events
...
Hide that the pmu_event structs are an array with a new wrapper struct.
Signed-off-by: Ian Rogers <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: James Clark <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: John Garry <[email protected] >
Cc: Kan Liang <[email protected] >
Cc: Leo Yan <[email protected] >
Cc: Mark Rutland <[email protected] >
Cc: Mike Leach <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Ravi Bangoria <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: Will Deacon <[email protected] >
Cc: Xing Zhengjun <[email protected] >
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2022-08-13 15:02:08 -03:00
Ian Rogers
660842e468
perf pmu-events: Don't assume pmu_event is an array
...
The current code assumes that a struct pmu_event can be iterated over
forward until a NULL pmu_event is encountered.
This makes it difficult to refactor pmu_event.
Add a loop function taking a callback function that's passed the struct
pmu_event.
This way the pmu_event is only needed for one element and not an entire
array.
Switch existing code iterating over the pmu_event arrays to use the new
loop function pmu_events_table_for_each_event.
Signed-off-by: Ian Rogers <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: James Clark <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: John Garry <[email protected] >
Cc: Kan Liang <[email protected] >
Cc: Leo Yan <[email protected] >
Cc: Mark Rutland <[email protected] >
Cc: Mike Leach <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Ravi Bangoria <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: Will Deacon <[email protected] >
Cc: Xing Zhengjun <[email protected] >
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2022-08-13 15:01:31 -03:00
Ian Rogers
eeac773041
perf pmu-events: Avoid passing pmu_events_map
...
Preparation for hiding pmu_events_map as an implementation detail. While
the map is passed, the table of events is all that is normally wanted.
While modifying the function's types, rename pmu_events_map__find to
pmu_events_table__find to match later encapsulation. Similarly rename
pmu_add_cpu_aliases_map to pmu_add_cpu_aliases_table.
Signed-off-by: Ian Rogers <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: James Clark <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: John Garry <[email protected] >
Cc: Kan Liang <[email protected] >
Cc: Leo Yan <[email protected] >
Cc: Mark Rutland <[email protected] >
Cc: Mike Leach <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Ravi Bangoria <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: Will Deacon <[email protected] >
Cc: Xing Zhengjun <[email protected] >
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2022-08-13 15:00:32 -03:00
Ian Rogers
47f572aad5
perf pmu: Make pmu_event tables const.
...
Make lookup nature of data structures clearer through their type. Reduce
scope of architecture specific pmu_event tables by making them static.
Suggested-by: John Garry <[email protected] >
Reviewed-by: John Garry <[email protected] >
Signed-off-by: Ian Rogers <[email protected] >
Acked-by: Andi Kleen <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Alexander Antonov <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Andrew Kilroy <[email protected] >
Cc: Andrew Morton <[email protected] >
Cc: Changbin Du <[email protected] >
Cc: Denys Zagorui <[email protected] >
Cc: Fabian Hemmer <[email protected] >
Cc: Felix Fietkau <[email protected] >
Cc: Heiko Carstens <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Jacob Keller <[email protected] >
Cc: Jiapeng Chong <[email protected] >
Cc: Jin Yao <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Joakim Zhang <[email protected] >
Cc: Kajol Jain <[email protected] >
Cc: Kan Liang <[email protected] >
Cc: Kees Kook <[email protected] >
Cc: Mark Rutland <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Nicholas Fraser <[email protected] >
Cc: Nick Desaulniers <[email protected] >
Cc: Paul Clarke <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Riccardo Mancini <[email protected] >
Cc: Sami Tolvanen <[email protected] >
Cc: ShihCheng Tu <[email protected] >
Cc: Song Liu <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: Sumanth Korikkar <[email protected] >
Cc: Thomas Richter <[email protected] >
Cc: Wan Jiabing <[email protected] >
Cc: Zhen Lei <[email protected] >
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2021-10-20 10:32:33 -03:00
Ian Rogers
0ec43c0837
perf pmu: Add const to pmu_events_map.
...
The pmu_events_map is generated at compile time and used for lookup. For
testing purposes we need to swap the map being used.
Having the pmu_events_map be non-const is misleading as it may be an out
argument.
Make it const and update uses so they work on const too.
Reviewed-by: John Garry <[email protected] >
Signed-off-by: Ian Rogers <[email protected] >
Acked-by: Andi Kleen <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Alexander Antonov <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Andrew Kilroy <[email protected] >
Cc: Andrew Morton <[email protected] >
Cc: Changbin Du <[email protected] >
Cc: Denys Zagorui <[email protected] >
Cc: Fabian Hemmer <[email protected] >
Cc: Felix Fietkau <[email protected] >
Cc: Heiko Carstens <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Jacob Keller <[email protected] >
Cc: Jiapeng Chong <[email protected] >
Cc: Jin Yao <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Joakim Zhang <[email protected] >
Cc: Kajol Jain <[email protected] >
Cc: Kan Liang <[email protected] >
Cc: Kees Kook <[email protected] >
Cc: Mark Rutland <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Nicholas Fraser <[email protected] >
Cc: Nick Desaulniers <[email protected] >
Cc: Paul Clarke <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Riccardo Mancini <[email protected] >
Cc: Sami Tolvanen <[email protected] >
Cc: ShihCheng Tu <[email protected] >
Cc: Song Liu <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: Sumanth Korikkar <[email protected] >
Cc: Thomas Richter <[email protected] >
Cc: Wan Jiabing <[email protected] >
Cc: Zhen Lei <[email protected] >
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2021-10-20 10:31:47 -03:00
John Garry
e126bef55f
perf pmu: Add pmu_events_map__find() function to find the common PMU map for the system
...
Add a function to find the common PMU map for the system.
For arm64, a special variant is added. This is because arm64 supports
heterogeneous CPU systems. As such, it cannot be guaranteed that the
cpumap is same for all CPUs. So in case of heterogeneous systems, don't
return a cpumap.
Reviewed-by: Kajol Jain <[email protected] >
Signed-off-by: John Garry <[email protected] >
Tested-by: Paul A. Clarke <[email protected] >
Acked-by: Jiri Olsa <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Ian Rogers <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Kan Liang <[email protected] >
Cc: Leo Yan <[email protected] >
Cc: Mark Rutland <[email protected] >
Cc: Mathieu Poirier <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Shaokun Zhang <[email protected] >
Cc: Will Deacon <[email protected] >
Cc: [email protected]
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2021-04-08 14:24:14 -03:00
Arnaldo Carvalho de Melo
44d2a55736
perf evlist: Use the right prefix for 'struct evlist' raw samples methods
...
perf_evlist__ is for 'struct perf_evlist' methods, in tools/lib/perf/,
go on completing this split.
Cc: Adrian Hunter <[email protected] >
Cc: Ian Rogers <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2020-11-30 15:15:30 -03:00
Arnaldo Carvalho de Melo
3ccf8a7b66
perf evlist: Use the right prefix for 'struct evlist' sample id lookup methods
...
perf_evlist__ is for 'struct perf_evlist' methods, in tools/lib/perf/,
go on completing this split.
Cc: Adrian Hunter <[email protected] >
Cc: Ian Rogers <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2020-11-30 14:17:57 -03:00
Arnaldo Carvalho de Melo
fb71c86cc8
perf tools: Remove util.h from where it is not needed
...
Check that it is not needed and remove, fixing up some fallout for
places where it was only serving to get something else.
Cc: Adrian Hunter <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Link: https://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2019-09-20 09:19:20 -03:00
Arnaldo Carvalho de Melo
d3300a3c4e
perf symbols: Move mem_info and branch_info out of symbol.h
...
The mem_info struct goes to mem-events.h and branch_info goes to
branch.h, where they belong, this way we can remove several headers from
symbols.h and trim the include dependency tree more.
Cc: Adrian Hunter <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Link: https://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2019-08-31 22:27:48 -03:00
Arnaldo Carvalho de Melo
f2a39fe849
perf auxtrace: Uninline functions that touch perf_session
...
So that we don't carry the session.h include directive in auxtrace.h,
which in turn opens a can of worms of files that were getting all sorts
of things via that include, fix them all.
Cc: Adrian Hunter <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Link: https://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2019-08-31 22:24:10 -03:00
Jiri Olsa
1fc632cef4
libperf: Move perf_event_attr field from perf's evsel to libperf's perf_evsel
...
Move the perf_event_attr struct fron 'struct evsel' to 'struct perf_evsel'.
Committer notes:
Fixed up these:
tools/perf/arch/arm/util/auxtrace.c
tools/perf/arch/arm/util/cs-etm.c
tools/perf/arch/arm64/util/arm-spe.c
tools/perf/arch/s390/util/auxtrace.c
tools/perf/util/cs-etm.c
Also
cc1: warnings being treated as errors
tests/sample-parsing.c: In function 'do_test':
tests/sample-parsing.c:162: error: missing initializer
tests/sample-parsing.c:162: error: (near initialization for 'evsel.core.cpus')
struct evsel evsel = {
.needs_swap = false,
- .core.attr = {
- .sample_type = sample_type,
- .read_format = read_format,
+ .core = {
+ . attr = {
+ .sample_type = sample_type,
+ .read_format = read_format,
+ },
[perfbuilder@a70e4eeb5549 /]$ gcc --version |& head -1
gcc (GCC) 4.4.7
Also we don't need to include perf_event.h in
tools/perf/lib/include/perf/evsel.h, forward declaring 'struct
perf_event_attr' is enough. And this even fixes the build in some
systems where things are used somewhere down the include path from
perf_event.h without defining __always_inline.
Signed-off-by: Jiri Olsa <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Alexey Budankov <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Michael Petlan <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2019-07-29 18:34:45 -03:00
Jiri Olsa
63503dba87
perf evlist: Rename struct perf_evlist to struct evlist
...
Rename struct perf_evlist to struct evlist, so we don't have a name
clash when we add struct perf_evlist in libperf.
Committer notes:
Added fixes to build on arm64, from Jiri and from me
(tools/perf/util/cs-etm.c)
Signed-off-by: Jiri Olsa <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Alexey Budankov <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Michael Petlan <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2019-07-29 18:34:42 -03:00
Jiri Olsa
32dcd021d0
perf evsel: Rename struct perf_evsel to struct evsel
...
Rename struct perf_evsel to struct evsel, so we don't have a name clash
when we add struct perf_evsel in libperf.
Committer notes:
Added fixes for arm64, provided by Jiri.
Signed-off-by: Jiri Olsa <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Alexey Budankov <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Michael Petlan <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2019-07-29 18:34:42 -03:00
Thomas Richter
3e4a1c536b
perf report: Display names in s390 diagnostic counter sets
...
On s390 the CPU Measurement Facility diagnostic counter sets are
displayed by counter number and value. Add the logical counter name in
the output (if it is available). Otherwise "unknown" is shown.
Output before:
[root@s35lp76 perf]# ./perf report -D --stdio
[00000000] Counterset:0 Counters:6
Counter:000 Value:0x000000000085ec36 Counter:001 Value:0x0000000000796c94
Counter:002 Value:0x0000000000005ada Counter:003 Value:0x0000000000092460
Counter:004 Value:0x0000000000006073 Counter:005 Value:0x00000000001a9a73
[0x000038] Counterset:1 Counters:2
Counter:000 Value:0x000000000007c59f Counter:001 Value:0x000000000002fad6
[0x000050] Counterset:2 Counters:16
Counter:000 Value:000000000000000000 Counter:001 Value:000000000000000000
Output after:
[root@s35lp76 perf]# ./perf report -D --stdio
[00000000] Counterset:0 Counters:6
Counter:000 cpu_cycles Value:0x000000000085ec36
Counter:001 instructions Value:0x0000000000796c94
Counter:002 l1i_dir_writes Value:0x0000000000005ada
Counter:003 l1i_penalty_cycles Value:0x0000000000092460
Counter:004 l1d_dir_writes Value:0x0000000000006073
Counter:005 l1d_penalty_cycles Value:0x00000000001a9a73
[0x000038] Counterset:1 Counters:2
Counter:000 problem_state_cpu_cycles Value:0x000000000007c59f
Counter:001 problem_state_instructions Value:0x000000000002fad6
[0x000050] Counterset:2 Counters:16
Counter:000 prng_functions Value:000000000000000000
Signed-off-by: Thomas Richter <[email protected] >
Reviewed-by: Hendrik Brueckner <[email protected] >
Cc: Heiko Carstens <[email protected] >
Cc: Martin Schwidefsky <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2019-01-21 17:00:56 -03:00
Thomas Richter
93115d32e8
perf report: Display arch specific diagnostic counter sets, starting with s390
...
On s390 the event bc000 (also named CF_DIAG) extracts the CPU
Measurement Facility diagnostic counter sets and displays them as
counter number and counter value pairs sorted by counter set number.
Output:
[root@s35lp76 perf]# ./perf report -D --stdio
[00000000] Counterset:0 Counters:6
Counter:000 Value:0x000000000085ec36 Counter:001 Value:0x0000000000796c94
Counter:002 Value:0x0000000000005ada Counter:003 Value:0x0000000000092460
Counter:004 Value:0x0000000000006073 Counter:005 Value:0x00000000001a9a73
[0x000038] Counterset:1 Counters:2
Counter:000 Value:0x000000000007c59f Counter:001 Value:0x000000000002fad6
[0x000050] Counterset:2 Counters:16
Counter:000 Value:000000000000000000 Counter:001 Value:000000000000000000
Counter:002 Value:000000000000000000 Counter:003 Value:000000000000000000
Counter:004 Value:000000000000000000 Counter:005 Value:000000000000000000
Counter:006 Value:000000000000000000 Counter:007 Value:000000000000000000
Counter:008 Value:000000000000000000 Counter:009 Value:000000000000000000
Counter:010 Value:000000000000000000 Counter:011 Value:000000000000000000
Counter:012 Value:000000000000000000 Counter:013 Value:000000000000000000
Counter:014 Value:000000000000000000 Counter:015 Value:000000000000000000
[0x0000d8] Counterset:3 Counters:128
Counter:000 Value:0x000000000000020f Counter:001 Value:0x00000000000001d8
Counter:002 Value:0x000000000000d7fa Counter:003 Value:0x000000000000008b
...
The number in brackets is the offset into the raw data field of the
sample.
New functions trace_event_sample_raw__init() and s390_sample_raw() are
introduced in the code path to enable interpretation on non s390
platforms. This event bc000 attached raw data is generated only on s390
platform. Correct display on other platforms requires correct endianness
handling.
Committer notes:
Added a init function that sets up a evlist function pointer to avoid
repeated tests on evlist->env and calls to perf_env__name() that
involves normalizing, etc, for each PERF_RECORD_SAMPLE.
Removed needless __maybe_unused from the trace_event_raw()
prototype in session.h, move it to be an static function in evlist.
The 'offset' variable is a size_t, not an u64, fix it to avoid this on
some arches:
CC /tmp/build/perf/util/s390-sample-raw.o
util/s390-sample-raw.c: In function 's390_cpumcfdg_testctr':
util/s390-sample-raw.c:77:4: error: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'size_t' [-Werror=format=]
pr_err("Invalid counter set entry at %#" PRIx64 "\n",
^
cc1: all warnings being treated as errors
Signed-off-by: Thomas Richter <[email protected] >
Reviewed-by: Hendrik Brueckner <[email protected] >
Link: https://lkml.kernel.org/r/[email protected]
Cc: Martin Schwidefsky <[email protected] >
Cc: Heiko Carstens <[email protected] >
Link: https://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2019-01-21 17:00:48 -03:00