linux/tools/perf
Yang Jihong 2e4dd65d7d perf tools: Add printing perf_event_attr type symbol in perf_event_attr__fprintf()
When printing perf_event_attr, always display perf_event_attr type and
its symbol to improve the readability of debugging information.

Before:

  # perf --debug verbose=2 record -e cycles,cpu-clock,sched:sched_switch,branch-load-misses,r101,mem:0x0 -C 0 true
  <SNIP>
  ------------------------------------------------------------
  perf_event_attr:
    size                             136
    { sample_period, sample_freq }   4000
    sample_type                      IP|TID|TIME|CPU|PERIOD|IDENTIFIER
    read_format                      ID
    disabled                         1
    inherit                          1
    freq                             1
    sample_id_all                    1
    exclude_guest                    1
  ------------------------------------------------------------
  sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8 = 5
  ------------------------------------------------------------
  perf_event_attr:
    type                             1
    size                             136
    { sample_period, sample_freq }   4000
    sample_type                      IP|TID|TIME|CPU|PERIOD|IDENTIFIER
    read_format                      ID
    disabled                         1
    inherit                          1
    freq                             1
    sample_id_all                    1
    exclude_guest                    1
  ------------------------------------------------------------
  sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8 = 6
  ------------------------------------------------------------
  perf_event_attr:
    type                             2
    size                             136
    config                           0x143
    { sample_period, sample_freq }   1
    sample_type                      IP|TID|TIME|CPU|PERIOD|RAW|IDENTIFIER
    read_format                      ID
    disabled                         1
    inherit                          1
    sample_id_all                    1
    exclude_guest                    1
  ------------------------------------------------------------
  sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8 = 7
  ------------------------------------------------------------
  perf_event_attr:
    type                             3
    size                             136
    config                           0x10005
    { sample_period, sample_freq }   4000
    sample_type                      IP|TID|TIME|CPU|PERIOD|IDENTIFIER
    read_format                      ID
    disabled                         1
    inherit                          1
    freq                             1
    sample_id_all                    1
    exclude_guest                    1
  ------------------------------------------------------------
  sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8 = 9
  ------------------------------------------------------------
  perf_event_attr:
    type                             4
    size                             136
    config                           0x101
    { sample_period, sample_freq }   4000
    sample_type                      IP|TID|TIME|CPU|PERIOD|IDENTIFIER
    read_format                      ID
    disabled                         1
    inherit                          1
    freq                             1
    sample_id_all                    1
    exclude_guest                    1
  ------------------------------------------------------------
  sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8 = 10
  ------------------------------------------------------------
  perf_event_attr:
    type                             5
    size                             136
    { sample_period, sample_freq }   1
    sample_type                      IP|TID|TIME|CPU|IDENTIFIER
    read_format                      ID
    disabled                         1
    inherit                          1
    sample_id_all                    1
    exclude_guest                    1
    bp_type                          3
    { bp_len, config2 }              0x4
  ------------------------------------------------------------
  <SNIP>

After:

  # perf --debug verbose=2 record -e cycles,cpu-clock,sched:sched_switch,branch-load-misses,r101,mem:0x0 -C 0 true
  <SNIP>
  ------------------------------------------------------------
  perf_event_attr:
    type                             0 (PERF_TYPE_HARDWARE)
    size                             136
    { sample_period, sample_freq }   4000
    sample_type                      IP|TID|TIME|CPU|PERIOD|IDENTIFIER
    read_format                      ID
    disabled                         1
    inherit                          1
    freq                             1
    sample_id_all                    1
    exclude_guest                    1
  ------------------------------------------------------------
  sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8 = 5
  ------------------------------------------------------------
  perf_event_attr:
    type                             1 (PERF_TYPE_SOFTWARE)
    size                             136
    { sample_period, sample_freq }   4000
    sample_type                      IP|TID|TIME|CPU|PERIOD|IDENTIFIER
    read_format                      ID
    disabled                         1
    inherit                          1
    freq                             1
    sample_id_all                    1
    exclude_guest                    1
  ------------------------------------------------------------
  sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8 = 6
  ------------------------------------------------------------
  perf_event_attr:
    type                             2 (PERF_TYPE_TRACEPOINT)
    size                             136
    config                           0x143
    { sample_period, sample_freq }   1
    sample_type                      IP|TID|TIME|CPU|PERIOD|RAW|IDENTIFIER
    read_format                      ID
    disabled                         1
    inherit                          1
    sample_id_all                    1
    exclude_guest                    1
  ------------------------------------------------------------
  sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8 = 7
  ------------------------------------------------------------
  perf_event_attr:
    type                             3 (PERF_TYPE_HW_CACHE)
    size                             136
    config                           0x10005
    { sample_period, sample_freq }   4000
    sample_type                      IP|TID|TIME|CPU|PERIOD|IDENTIFIER
    read_format                      ID
    disabled                         1
    inherit                          1
    freq                             1
    sample_id_all                    1
    exclude_guest                    1
  ------------------------------------------------------------
  sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8 = 9
  ------------------------------------------------------------
  perf_event_attr:
    type                             4 (PERF_TYPE_RAW)
    size                             136
    config                           0x101
    { sample_period, sample_freq }   4000
    sample_type                      IP|TID|TIME|CPU|PERIOD|IDENTIFIER
    read_format                      ID
    disabled                         1
    inherit                          1
    freq                             1
    sample_id_all                    1
    exclude_guest                    1
  ------------------------------------------------------------
  sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8 = 10
  ------------------------------------------------------------
  perf_event_attr:
    type                             5 (PERF_TYPE_BREAKPOINT)
    size                             136
    { sample_period, sample_freq }   1
    sample_type                      IP|TID|TIME|CPU|IDENTIFIER
    read_format                      ID
    disabled                         1
    inherit                          1
    sample_id_all                    1
    exclude_guest                    1
    bp_type                          3
    { bp_len, config2 }              0x4
  ------------------------------------------------------------
  <SNIP>

Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: anshuman.khandual@arm.com
Cc: mark.rutland@arm.com
Cc: irogers@google.com
Cc: jesussanp@google.com
Cc: peterz@infradead.org
Cc: acme@kernel.org
Cc: jolsa@kernel.org
Cc: alexander.shishkin@linux.intel.com
Cc: mingo@redhat.com
Link: https://lore.kernel.org/r/20230623054416.160858-4-yangjihong1@huawei.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2023-06-23 22:30:30 -07:00
..
arch perf annotate: Fix instruction association and parsing for LoongArch 2023-06-20 21:55:06 -07:00
bench perf bench sched messaging: Free contexts on exit 2023-06-12 18:18:14 -03:00
dlfilters perf tools: Fix usage of the verbose variable 2022-12-20 15:16:33 -03:00
Documentation perf stat: Document --metric-no-threshold and threshold colors 2023-06-05 16:04:14 -03:00
examples/bpf perf trace: Remove unused bpf map 'syscalls' 2022-11-23 10:30:00 -03:00
include/perf perf bpf: Remove now unused BPF headers 2022-11-04 11:41:48 -03:00
jvmti
pmu-events perf vendor events arm64: Add default tags for Hisi hip08 L1 metrics 2023-06-16 09:59:41 -03:00
python
scripts perf python scripting: Get rid of unused import in arm-cs-trace-disasm 2023-06-13 23:40:33 -03:00
tests perf symbol: Remove now unused symbol_conf.sort_by_name 2023-06-23 21:48:49 -07:00
trace perf thread: Add accessor functions for thread 2023-06-12 15:57:53 -03:00
ui perf annotation: Switch lock from a mutex to a sharded_mutex 2023-06-20 17:04:21 -07:00
util perf tools: Add printing perf_event_attr type symbol in perf_event_attr__fprintf() 2023-06-23 22:30:30 -07:00
.gitignore perf jevents: Run metric_test.py at compile-time 2023-02-03 17:11:39 -03:00
Build perf script: Fix Python support when no libtraceevent 2023-03-15 10:27:07 -03:00
builtin-annotate.c perf addr_location: Add init/exit/copy functions 2023-06-12 15:57:53 -03:00
builtin-bench.c perf bench: Add missing setlocale() call to allow usage of %'d style formatting 2023-06-05 10:36:58 -03:00
builtin-buildid-cache.c
builtin-buildid-list.c perf util: Move input_name to util 2023-04-10 19:21:31 -03:00
builtin-c2c.c perf callchain: Use pthread keys for tls callchain_cursor 2023-06-12 15:57:54 -03:00
builtin-config.c perf path: Make mkpath thread safe, remove 16384 bytes from .bss 2023-05-28 10:24:14 -03:00
builtin-daemon.c perf daemon: Dynamically allocate path to perf 2023-05-28 10:23:23 -03:00
builtin-data.c perf util: Move input_name to util 2023-04-10 19:21:31 -03:00
builtin-diff.c perf srcline: Optimize comparision against SRCLINE_UNKNOWN 2023-06-12 18:17:00 -03:00
builtin-evlist.c perf util: Move input_name to util 2023-04-10 19:21:31 -03:00
builtin-ftrace.c perf tools fixes for v6.4: 2nd batch 2023-05-31 15:31:56 -03:00
builtin-help.c perf path: Make mkpath thread safe, remove 16384 bytes from .bss 2023-05-28 10:24:14 -03:00
builtin-inject.c perf inject: Lazily allocate guest_event event_buf 2023-06-12 18:18:14 -03:00
builtin-kallsyms.c perf symbol: Remove now unused symbol_conf.sort_by_name 2023-06-23 21:48:49 -07:00
builtin-kmem.c perf callchain: Use pthread keys for tls callchain_cursor 2023-06-12 15:57:54 -03:00
builtin-kvm.c perf evsel: Introduce evsel__name_is() method to check if the evsel name is equal to a given string 2023-04-24 14:28:11 -03:00
builtin-kwork.c perf callchain: Use pthread keys for tls callchain_cursor 2023-06-12 15:57:54 -03:00
builtin-list.c perf list: Check arguments to show libpfm4 events 2023-06-12 15:57:53 -03:00
builtin-lock.c perf symbol: Remove now unused symbol_conf.sort_by_name 2023-06-23 21:48:49 -07:00
builtin-mem.c perf addr_location: Add init/exit/copy functions 2023-06-12 15:57:53 -03:00
builtin-probe.c perf probe: Dynamically allocate params memory 2023-05-28 10:24:02 -03:00
builtin-record.c perf pmus: Remove perf_pmus__has_hybrid 2023-05-27 09:42:38 -03:00
builtin-report.c perf symbol: Remove now unused symbol_conf.sort_by_name 2023-06-23 21:48:49 -07:00
builtin-sched.c perf sched: Avoid large stack allocations 2023-06-12 18:18:14 -03:00
builtin-script.c perf script: Remove some large stack allocations 2023-06-12 18:18:14 -03:00
builtin-stat.c perf stat: Add missing newline in pr_err messages 2023-06-20 15:55:13 -07:00
builtin-timechart.c perf addr_location: Add init/exit/copy functions 2023-06-12 15:57:53 -03:00
builtin-top.c perf annotation: Switch lock from a mutex to a sharded_mutex 2023-06-20 17:04:21 -07:00
builtin-trace.c perf callchain: Use pthread keys for tls callchain_cursor 2023-06-12 15:57:54 -03:00
builtin-version.c Revert "perf build: Make BUILD_BPF_SKEL default, rename to NO_BPF_SKEL" 2023-05-06 18:07:37 -03:00
builtin.h perf usage: Move usage strings 2023-04-10 19:20:53 -03:00
check-headers.sh tools headers: Make the difference output easier to read 2023-06-09 10:56:40 -03:00
command-list.txt perf help: Use HAVE_LIBTRACEEVENT to filter out unsupported commands 2023-01-02 11:51:53 -03:00
CREDITS
design.txt
Makefile perf tools: Use "grep -E" instead of "egrep" 2022-12-14 15:28:19 -03:00
Makefile.config perf build: Add ability to build with a generated vmlinux.h 2023-06-23 21:35:45 -07:00
Makefile.perf perf build: Filter out BTF sources without a .BTF section 2023-06-23 21:35:46 -07:00
MANIFEST tools lib traceevent: Remove libtraceevent 2022-12-14 11:16:12 -03:00
perf-archive.sh
perf-completion.sh perf tools: Fix auto-complete on aarch64 2023-02-08 10:38:10 -03:00
perf-iostat.sh
perf-read-vdso.c
perf-sys.h
perf.c perf util: Move input_name to util 2023-04-10 19:21:31 -03:00
perf.h perf util: Move perf_guest/host declarations 2023-04-10 19:22:05 -03:00