Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169709
b: refs/heads/master
c: c338aee
h: refs/heads/master
i:
  169707: bd58e1b
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and Ingo Molnar committed Nov 21, 2009
1 parent 954b09f commit bde543f
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 162 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: 78075caad99dc36ec6ef5826b7a5273ea14295fc
refs/heads/master: c338aee853db197e1855b393e6d6cc667784537f
8 changes: 4 additions & 4 deletions trunk/tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)

if (event->header.misc & PERF_RECORD_MISC_KERNEL) {
level = 'k';
sym = kernel_maps__find_symbol(ip, &map);
sym = kernel_maps__find_symbol(ip, &map, symbol_filter);
dump_printf(" ...... dso: %s\n",
map ? map->dso->long_name : "<not found>");
} else if (event->header.misc & PERF_RECORD_MISC_USER) {
Expand Down Expand Up @@ -637,9 +637,9 @@ static int __cmd_annotate(void)
exit(0);
}

if (load_kernel(symbol_filter, use_modules) < 0) {
perror("failed to load kernel symbols");
return EXIT_FAILURE;
if (kernel_maps__init(use_modules) < 0) {
pr_err("failed to create kernel maps for symbol resolution\b");
return -1;
}

remap:
Expand Down
6 changes: 3 additions & 3 deletions trunk/tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ resolve_symbol(struct thread *thread, struct map **mapp, u64 *ipp)
* trick of looking in the whole kernel symbol list.
*/
if ((long long)ip < 0)
return kernel_maps__find_symbol(ip, mapp);
return kernel_maps__find_symbol(ip, mapp, NULL);
}
dump_printf(" ...... dso: %s\n",
map ? map->dso->long_name : "<not found>");
Expand Down Expand Up @@ -496,7 +496,7 @@ static struct symbol **resolve_callchain(struct thread *thread, struct map *map,
case PERF_CONTEXT_HV:
break;
case PERF_CONTEXT_KERNEL:
sym = kernel_maps__find_symbol(ip, &map);
sym = kernel_maps__find_symbol(ip, &map, NULL);
break;
default:
sym = resolve_symbol(thread, &map, &ip);
Expand Down Expand Up @@ -716,7 +716,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)

if (cpumode == PERF_RECORD_MISC_KERNEL) {
level = 'k';
sym = kernel_maps__find_symbol(ip, &map);
sym = kernel_maps__find_symbol(ip, &map, NULL);
dump_printf(" ...... dso: %s\n",
map ? map->dso->long_name : "<not found>");
} else if (cpumode == PERF_RECORD_MISC_USER) {
Expand Down
35 changes: 7 additions & 28 deletions trunk/tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,8 @@ static void handle_keypress(int c)
case 'q':
case 'Q':
printf("exiting.\n");
if (dump_symtab)
dsos__fprintf(stderr);
exit(0);
case 's':
prompt_symbol(&sym_filter_entry, "Enter details symbol");
Expand Down Expand Up @@ -946,30 +948,6 @@ static int symbol_filter(struct map *map, struct symbol *sym)
return 0;
}

static int parse_symbols(void)
{
struct dso *kernel = dsos__load_kernel();

if (kernel == NULL)
return -1;

if (dsos__load_modules() < 0)
pr_debug("Couldn't read the complete list of modules, "
"continuing...\n");

if (dsos__load_modules_sym(symbol_filter) < 0)
pr_warning("Failed to read module symbols, continuing...\n");

if (dso__load_kernel_sym(kernel, symbol_filter, 1) <= 0)
pr_debug("Couldn't read the complete list of kernel symbols, "
"continuing...\n");

if (dump_symtab)
dsos__fprintf(stderr);

return 0;
}

static void event__process_sample(const event_t *self, int counter)
{
u64 ip = self->ip.ip;
Expand Down Expand Up @@ -1012,7 +990,7 @@ static void event__process_sample(const event_t *self, int counter)
if (hide_kernel_symbols)
return;

sym = kernel_maps__find_symbol(ip, &map);
sym = kernel_maps__find_symbol(ip, &map, symbol_filter);
if (sym == NULL)
return;
break;
Expand Down Expand Up @@ -1339,7 +1317,7 @@ static const struct option options[] = {

int cmd_top(int argc, const char **argv, const char *prefix __used)
{
int counter;
int counter, err;

page_size = sysconf(_SC_PAGE_SIZE);

Expand All @@ -1363,10 +1341,11 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
if (delay_secs < 1)
delay_secs = 1;

parse_symbols();
err = kernel_maps__init(true);
if (err < 0)
return err;
parse_source(sym_filter_entry);


/*
* User specified count overrides default frequency.
*/
Expand Down
4 changes: 2 additions & 2 deletions trunk/tools/perf/util/data_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ int mmap_dispatch_perf_file(struct perf_header **pheader,
goto out_delete;

err = -ENOMEM;
if (load_kernel(NULL, 1) < 0) {
pr_err("failed to load kernel symbols\n");
if (kernel_maps__init(true) < 0) {
pr_err("failed to setup the kernel maps to resolve symbols\n");
goto out_delete;
}

Expand Down
3 changes: 3 additions & 0 deletions trunk/tools/perf/util/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,13 @@ typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);
void map__init(struct map *self, u64 start, u64 end, u64 pgoff,
struct dso *dso);
struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen);
void map__delete(struct map *self);
struct map *map__clone(struct map *self);
int map__overlap(struct map *l, struct map *r);
size_t map__fprintf(struct map *self, FILE *fp);
struct symbol *map__find_symbol(struct map *self, u64 ip, symbol_filter_t filter);
void map__fixup_start(struct map *self);
void map__fixup_end(struct map *self);

int event__synthesize_thread(pid_t pid, int (*process)(event_t *event));
void event__synthesize_threads(int (*process)(event_t *event));
Expand Down
6 changes: 3 additions & 3 deletions trunk/tools/perf/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ static int perf_header__adds_write(struct perf_header *self, int fd)

buildid_sec = &feat_sec[idx++];

dsos__load_kernel();
/*
* Read the list of loaded modules with its build_ids
* Read the kernel buildid nad the list of loaded modules with
* its build_ids:
*/
dsos__load_modules();
kernel_maps__init(true);

/* Write build-ids */
buildid_sec->offset = lseek(fd, 0, SEEK_CUR);
Expand Down
23 changes: 23 additions & 0 deletions trunk/tools/perf/util/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,29 @@ struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen)
return NULL;
}

void map__delete(struct map *self)
{
free(self);
}

void map__fixup_start(struct map *self)
{
struct rb_node *nd = rb_first(&self->dso->syms);
if (nd != NULL) {
struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
self->start = sym->start;
}
}

void map__fixup_end(struct map *self)
{
struct rb_node *nd = rb_last(&self->dso->syms);
if (nd != NULL) {
struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
self->end = sym->end;
}
}

#define DSO__DELETED "(deleted)"

struct symbol *
Expand Down
Loading

0 comments on commit bde543f

Please sign in to comment.