perf tools: Add symfs option for off-box analysis using specified tree
PATCH v2 1/1 perf tools: Add symfs option for off-box analysis using specified tree
The symfs argument allows analysis of perf.data file using a locally accessible filesystem tree with debug symbols - e.g., tree created during image builds, sshfs mount, loop mounted KVM disk images, USB keys, initrds, etc. Anything with an OS tree can be analyzed from anywhere without the need to populate a local data store with build-ids.
v1 --> v2: removed symfs changes from builtin-annotate.c
fixed tab/space inconsistencies changed new strlen() to symbol_conf.symfs[0] added symfs option to Documentation files
--- tools/perf/Documentation/perf-diff.txt | 2 + tools/perf/Documentation/perf-report.txt | 3 ++ tools/perf/Documentation/perf-timechart.txt | 2 + tools/perf/builtin-diff.c | 2 + tools/perf/builtin-report.c | 2 + tools/perf/builtin-timechart.c | 2 + tools/perf/util/hist.c | 14 ++++++-- tools/perf/util/symbol.c | 50 +++++++++++++++++++-------- tools/perf/util/symbol.h | 1 + 9 files changed, 60 insertions(+), 18 deletions(-)
tools/perf/Documentation/perf-diff.txt +2 -0
@@ -66,6 +66,8 @@ OPTIONS --force:: Don't complain, do it. +--symfs=<directory>:: + Look for files with symbols relative to this directory. SEE ALSO --------
tools/perf/Documentation/perf-report.txt +3 -0
@@ -113,6 +113,9 @@ OPTIONS --force:: Don't complain, do it. +--symfs=<directory>:: + Look for files with symbols relative to this directory. + SEE ALSO -------- linkperf:perf-stat[1]
tools/perf/Documentation/perf-timechart.txt +2 -0
@@ -38,6 +38,8 @@ OPTIONS --process:: Select the processes to display, by name or PID +--symfs=<directory>:: + Look for files with symbols relative to this directory. SEE ALSO --------
tools/perf/builtin-diff.c +2 -0
@@ -192,6 +192,8 @@ static const struct option options[] = {OPT_STRING ('t' ,"field-separator" , &symbol_conf.field_sep,"separator" ,"separator for columns, no spaces will be added between " "columns '.' is reserved." ), +OPT_STRING (0 ,"symfs" , &symbol_conf.symfs,"directory" , +"Look for files with symbols relative to this directory" ), OPT_END() };
tools/perf/builtin-report.c +2 -0
@@ -479,6 +479,8 @@ static const struct option options[] = { "columns '.' is reserved."),OPT_BOOLEAN ('U' ,"hide-unresolved" , &hide_unresolved,"Only display entries resolved to a symbol" ), +OPT_STRING (0 ,"symfs" , &symbol_conf.symfs,"directory" , +"Look for files with symbols relative to this directory" ), OPT_END() };
tools/perf/builtin-timechart.c +2 -0
@@ -1021,6 +1021,8 @@ static const struct option options[] = {OPT_CALLBACK ('p' ,"process" ,NULL ,"process" ,"process selector. Pass a pid or process name." , parse_process), +OPT_STRING (0 ,"symfs" , &symbol_conf.symfs,"directory" , +"Look for files with symbols relative to this directory" ), OPT_END() };
tools/perf/util/hist.c +11 -3
@@ -1092,6 +1092,12 @@ int hist_entry__annotate(struct hist_entry *self, struct list_head *head,FILE *file;int err =0 ;u64 len; +char symfs_filename[PATH_MAX ]; + +if (filename) { +snprintf (symfs_filename,sizeof (symfs_filename),"%s%s" , + symbol_conf.symfs, filename); + }if (filename ==NULL ) {if (dso->has_build_id) {
@@ -1100,9 +1106,9 @@ int hist_entry__annotate(struct hist_entry *self, struct list_head *head,return -ENOMEM ; } goto fallback; - }else if (readlink (filename, command,sizeof (command)) <0 || + }else if (readlink (symfs_filename, command,sizeof (command)) <0 ||strstr (command,"[kernel.kallsyms]" ) || -access (filename,R_OK )) { +access (symfs_filename,R_OK )) {free (filename); fallback:/*
@@ -1111,6 +1117,8 @@ fallback:* DSO is the same as when 'perf record' ran. */ filename = dso->long_name; +snprintf (symfs_filename,sizeof (symfs_filename),"%s%s" , + symbol_conf.symfs, filename); free_filename = false; }
@@ -1137,7 +1145,7 @@ fallback:"objdump --start-address=0x%016Lx --stop-address=0x%016Lx -dS -C %s|grep -v %s|expand" ,map__rip_2objdump (map, sym->start),map__rip_2objdump (map, sym->end), - filename, filename); + symfs_filename, filename);pr_debug ("Executing: %s\n" , command);
tools/perf/util/symbol.c +35 -15
115 lines not on this page · raw message
tools/perf/util/symbol.h +1 -0
@@ -85,6 +85,7 @@ struct symbol_conf {struct strlist *dso_list, *comm_list, *sym_list; +const char *symfs; };extern struct symbol_conf symbol_conf;
Signature · 1 line
1.7.2.3
Em Wed, Dec 08, 2010 at 07:33:40PM -0700, David Ahern escreveu:
Quoted 7 lines
The symfs argument allows analysis of perf.data file using a locally accessible filesystem tree with debug symbols - e.g., tree created during image builds, sshfs mount, loop mounted KVM disk images, USB keys, initrds, etc. Anything with an OS tree can be analyzed from anywhere without the need to populate a local data store with build-ids.
Quoted 6 lines
Signed-off-by David Ahern <[email protected]>v1 --> v2: removed symfs changes from
builtin-annotate.c
fixed tab/space inconsistencies changed newstrlen()to symbol_conf.symfs[0] added symfs option to Documentation files
So I tried it now with:
perf report --symfs /
Which should be equivalent to the common case:
perf report
Bu kernel symbols didn't got resolved, can you please check this?
- Arnaldo