Files
linux-cryptodev-2.6/tools/perf/util/symbol_conf.h
Ian Rogers a2297e74a0 perf srcline: Add configuration support for the addr2line style
Allow the addr2line style to be specified on the `perf report` command
line or in the .perfconfig file.

Committer testing:

The methods:

  # perf probe -x ~/bin/perf -F *__addr2line
  cmd__addr2line
  libbfd__addr2line
  libdw__addr2line
  llvm__addr2line
  #

So if we configure one of them, say 'addr2line':

  # perf config addr2line.style=addr2line
  # perf config addr2line.style
  addr2line.style=addr2line
  #

And have probes on all of them:

  # perf probe -x ~/bin/perf *__addr2line
  Added new events:
    probe_perf:cmd__addr2line (on *__addr2line in /home/acme/bin/perf)
    probe_perf:llvm__addr2line (on *__addr2line in /home/acme/bin/perf)
    probe_perf:libbfd__addr2line (on *__addr2line in /home/acme/bin/perf)
    probe_perf:libdw__addr2line (on *__addr2line in /home/acme/bin/perf)

  You can now use it in all perf tools, such as:

  	perf record -e probe_perf:libdw__addr2line -aR sleep 1

  #

Only the selected method should be used:

  # perf stat -e probe_perf:*_addr2line perf report -f --dso perf --stdio -s srcfile,srcline
  # Total Lost Samples: 0
  #
  # Samples: 4K of event 'cpu/cycles/Pu'
  # Event count (approx.): 5535180842
  #
  # Overhead  Source File   Source:Line
  # ........  ............  ...............
  #
      99.04%  inlineloop.c  inlineloop.c:21
       0.46%  inlineloop.c  inlineloop.c:20

  #
  # (Tip: For hierarchical output, try: perf report --hierarchy)
  #

   Performance counter stats for 'perf report -f --dso perf --stdio -s srcfile,srcline':

                  44      probe_perf:cmd__addr2line
                   0      probe_perf:llvm__addr2line
                   0      probe_perf:libbfd__addr2line
                   0      probe_perf:libdw__addr2line

         0.035915611 seconds time elapsed

         0.028008000 seconds user
         0.009051000 seconds sys
  #

I checked and that is the case for the other methods.

Also when using:

  # perf config addr2line.style=libdw,llvm

 Performance counter stats for 'perf report -f --dso perf --stdio -s srcfile,srcline':

                 0      probe_perf:cmd__addr2line
                23      probe_perf:llvm__addr2line
                 0      probe_perf:libbfd__addr2line
                44      probe_perf:libdw__addr2line

Reviewed-by: James Clark <james.clark@linaro.org>
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
Cc: Tony Jones <tonyj@suse.de>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2026-01-13 16:09:14 -03:00

106 lines
2.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __PERF_SYMBOL_CONF
#define __PERF_SYMBOL_CONF 1
#include <stdbool.h>
#include <linux/bitmap.h>
#include "perf.h"
struct strlist;
struct intlist;
enum a2l_style {
A2L_STYLE_UNKNOWN = 0,
A2L_STYLE_LIBDW,
A2L_STYLE_LLVM,
A2L_STYLE_LIBBFD,
A2L_STYLE_CMD,
};
#define MAX_A2L_STYLE (A2L_STYLE_CMD + 1)
struct symbol_conf {
bool nanosecs;
unsigned short priv_size;
bool try_vmlinux_path,
init_annotation,
force,
ignore_vmlinux,
ignore_vmlinux_buildid,
show_kernel_path,
use_modules,
allow_aliases,
show_nr_samples,
show_total_period,
use_callchain,
cumulate_callchain,
show_branchflag_count,
exclude_other,
show_cpu_utilization,
initialized,
kptr_restrict,
event_group,
demangle,
demangle_kernel,
filter_relative,
show_hist_headers,
has_filter,
show_ref_callgraph,
hide_unresolved,
raw_trace,
report_hierarchy,
report_block,
report_individual_block,
inline_name,
disable_add2line_warn,
no_buildid_mmap2,
guest_code,
lazy_load_kernel_maps,
keep_exited_threads,
annotate_data_member,
annotate_data_sample,
skip_empty,
enable_latency,
prefer_latency;
const char *vmlinux_name,
*kallsyms_name,
*source_prefix,
*field_sep,
*graph_function;
const char *default_guest_vmlinux_name,
*default_guest_kallsyms,
*default_guest_modules;
const char *guestmount;
const char *dso_list_str,
*comm_list_str,
*pid_list_str,
*tid_list_str,
*sym_list_str,
*parallelism_list_str,
*col_width_list_str,
*bt_stop_list_str;
const char *addr2line_path;
enum a2l_style addr2line_style[MAX_A2L_STYLE];
unsigned long time_quantum;
struct strlist *dso_list,
*comm_list,
*sym_list,
*dso_from_list,
*dso_to_list,
*sym_from_list,
*sym_to_list,
*bt_stop_list;
struct intlist *pid_list,
*tid_list,
*addr_list;
const char *symfs;
int res_sample;
int pad_output_len_dso;
int group_sort_idx;
int addr_range;
DECLARE_BITMAP(parallelism_filter, MAX_NR_CPUS + 1);
};
extern struct symbol_conf symbol_conf;
#endif // __PERF_SYMBOL_CONF