mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 13:41:30 +00:00
perf_counter tools: Enable kernel module symbol loading in tools
Add the -m/--modules option to perf report and perf annotate, which enables live module symbol/image loading. To be used with -k/--vmlinux. (Also give perf annotate a -P/--full-paths option.) Signed-off-by: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <1246514986.13293.48.camel@marge.simson.net> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
6cfcc53ed4
commit
429764873c
3 changed files with 38 additions and 8 deletions
|
@ -43,6 +43,10 @@ static int dump_trace = 0;
|
|||
|
||||
static int verbose;
|
||||
|
||||
static int modules;
|
||||
|
||||
static int full_paths;
|
||||
|
||||
static int print_line;
|
||||
|
||||
static unsigned long page_size;
|
||||
|
@ -171,7 +175,7 @@ static int load_kernel(void)
|
|||
if (!kernel_dso)
|
||||
return -1;
|
||||
|
||||
err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose, 0);
|
||||
err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose, modules);
|
||||
if (err <= 0) {
|
||||
dso__delete(kernel_dso);
|
||||
kernel_dso = NULL;
|
||||
|
@ -1268,19 +1272,25 @@ static void print_summary(char *filename)
|
|||
|
||||
static void annotate_sym(struct dso *dso, struct symbol *sym)
|
||||
{
|
||||
char *filename = dso->name;
|
||||
char *filename = dso->name, *d_filename;
|
||||
u64 start, end, len;
|
||||
char command[PATH_MAX*2];
|
||||
FILE *file;
|
||||
|
||||
if (!filename)
|
||||
return;
|
||||
if (dso == kernel_dso)
|
||||
if (sym->module)
|
||||
filename = sym->module->path;
|
||||
else if (dso == kernel_dso)
|
||||
filename = vmlinux;
|
||||
|
||||
start = sym->obj_start;
|
||||
if (!start)
|
||||
start = sym->start;
|
||||
if (full_paths)
|
||||
d_filename = filename;
|
||||
else
|
||||
d_filename = basename(filename);
|
||||
|
||||
end = start + sym->end - sym->start + 1;
|
||||
len = sym->end - sym->start;
|
||||
|
@ -1291,13 +1301,14 @@ static void annotate_sym(struct dso *dso, struct symbol *sym)
|
|||
}
|
||||
|
||||
printf("\n\n------------------------------------------------\n");
|
||||
printf(" Percent | Source code & Disassembly of %s\n", filename);
|
||||
printf(" Percent | Source code & Disassembly of %s\n", d_filename);
|
||||
printf("------------------------------------------------\n");
|
||||
|
||||
if (verbose >= 2)
|
||||
printf("annotating [%p] %30s : [%p] %30s\n", dso, dso->name, sym, sym->name);
|
||||
|
||||
sprintf(command, "objdump --start-address=0x%016Lx --stop-address=0x%016Lx -dS %s", (u64)start, (u64)end, filename);
|
||||
sprintf(command, "objdump --start-address=0x%016Lx --stop-address=0x%016Lx -dS %s|grep -v %s",
|
||||
(u64)start, (u64)end, filename, filename);
|
||||
|
||||
if (verbose >= 3)
|
||||
printf("doing: %s\n", command);
|
||||
|
@ -1472,8 +1483,12 @@ static const struct option options[] = {
|
|||
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
|
||||
"dump raw trace in ASCII"),
|
||||
OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
|
||||
OPT_BOOLEAN('m', "modules", &modules,
|
||||
"load module symbols - WARNING: use only with -k and LIVE kernel"),
|
||||
OPT_BOOLEAN('l', "print-line", &print_line,
|
||||
"print matching source lines (may be slow)"),
|
||||
OPT_BOOLEAN('P', "full-paths", &full_paths,
|
||||
"Don't shorten the displayed pathnames"),
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue