mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-04-29 12:28:27 +02:00
a2297e74a0
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>
69 lines
2.3 KiB
C
69 lines
2.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef PERF_SRCLINE_H
|
|
#define PERF_SRCLINE_H
|
|
|
|
#include <linux/list.h>
|
|
#include <linux/rbtree.h>
|
|
#include <linux/types.h>
|
|
|
|
struct dso;
|
|
struct symbol;
|
|
|
|
extern bool srcline_full_filename;
|
|
char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
|
|
bool show_sym, bool show_addr, u64 ip);
|
|
char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
|
|
bool show_sym, bool show_addr, bool unwind_inlines,
|
|
u64 ip);
|
|
void zfree_srcline(char **srcline);
|
|
char *get_srcline_split(struct dso *dso, u64 addr, unsigned *line);
|
|
|
|
/* insert the srcline into the DSO, which will take ownership */
|
|
void srcline__tree_insert(struct rb_root_cached *tree, u64 addr, char *srcline);
|
|
/* find previously inserted srcline */
|
|
char *srcline__tree_find(struct rb_root_cached *tree, u64 addr);
|
|
/* delete all srclines within the tree */
|
|
void srcline__tree_delete(struct rb_root_cached *tree);
|
|
|
|
extern char *srcline__unknown;
|
|
#define SRCLINE_UNKNOWN srcline__unknown
|
|
|
|
#define MAX_INLINE_NEST 1024
|
|
|
|
struct inline_list {
|
|
struct symbol *symbol;
|
|
char *srcline;
|
|
struct list_head list;
|
|
};
|
|
|
|
struct inline_node {
|
|
u64 addr;
|
|
struct list_head val;
|
|
struct rb_node rb_node;
|
|
};
|
|
|
|
/* parse inlined frames for the given address */
|
|
struct inline_node *dso__parse_addr_inlines(struct dso *dso, u64 addr,
|
|
struct symbol *sym);
|
|
/* free resources associated to the inline node list */
|
|
void inline_node__delete(struct inline_node *node);
|
|
|
|
/* insert the inline node list into the DSO, which will take ownership */
|
|
void inlines__tree_insert(struct rb_root_cached *tree,
|
|
struct inline_node *inlines);
|
|
/* find previously inserted inline node list */
|
|
struct inline_node *inlines__tree_find(struct rb_root_cached *tree, u64 addr);
|
|
/* delete all nodes within the tree of inline_node s */
|
|
void inlines__tree_delete(struct rb_root_cached *tree);
|
|
|
|
int inline_list__append(struct symbol *symbol, char *srcline, struct inline_node *node);
|
|
int inline_list__append_tail(struct symbol *symbol, char *srcline, struct inline_node *node);
|
|
char *srcline_from_fileline(const char *file, unsigned int line);
|
|
struct symbol *new_inline_sym(struct dso *dso,
|
|
struct symbol *base_sym,
|
|
const char *funcname);
|
|
|
|
int addr2line_configure(const char *var, const char *value, void *cb);
|
|
|
|
#endif /* PERF_SRCLINE_H */
|