Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147548
b: refs/heads/master
c: 450aaa2
h: refs/heads/master
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed May 27, 2009
1 parent 4e76784 commit 72181c2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b7a16eac5e679fb5f531b9eeff7db7952303e77d
refs/heads/master: 450aaa2b2a1b006870ba68251fbb40b2387caade
37 changes: 36 additions & 1 deletion trunk/Documentation/perf_counter/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define SHOW_HV 4

static char const *input_name = "perf.data";
static char *vmlinux = NULL;
static int input;
static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;

Expand Down Expand Up @@ -532,6 +533,39 @@ static int load_kallsyms(void)
return -1;
}

static int load_kernel(void)
{
int fd, nr;

if (!vmlinux)
goto kallsyms;

fd = open(vmlinux, O_RDONLY);
if (fd < 0)
goto kallsyms;

kernel_dso = dso__new("[kernel]");
if (!kernel_dso)
goto fail_open;

nr = dso__load_sym(kernel_dso, fd, vmlinux);

if (nr <= 0)
goto fail_load;

dsos__add(kernel_dso);
close(fd);

return 0;

fail_load:
dso__delete(kernel_dso);
fail_open:
close(fd);
kallsyms:
return load_kallsyms();
}

struct map {
struct list_head node;
uint64_t start;
Expand Down Expand Up @@ -850,7 +884,7 @@ static int __cmd_report(void)
exit(0);
}

if (load_kallsyms() < 0) {
if (load_kernel() < 0) {
perror("failed to open kallsyms");
return EXIT_FAILURE;
}
Expand Down Expand Up @@ -1039,6 +1073,7 @@ static const struct option options[] = {
"be more verbose (show symbol address, etc)"),
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
OPT_END()
};

Expand Down

0 comments on commit 72181c2

Please sign in to comment.