Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 191091
b: refs/heads/master
c: b0a9ab6
h: refs/heads/master
i:
  191089: f6846d5
  191087: 465edd7
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and Ingo Molnar committed Mar 15, 2010
1 parent 80a8890 commit e409f3a
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 22 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: bedbfdea31daf3880745001d56450c683959ee7e
refs/heads/master: b0a9ab62ab96e258a0ddd81d7fe2719c3db36006
33 changes: 25 additions & 8 deletions trunk/tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ static void sig_winch_handler(int sig __used)
update_print_entries(&winsize);
}

static void parse_source(struct sym_entry *syme)
static int parse_source(struct sym_entry *syme)
{
struct symbol *sym;
struct sym_entry_source *source;
Expand All @@ -180,12 +180,21 @@ static void parse_source(struct sym_entry *syme)
u64 len;

if (!syme)
return;
return -1;

sym = sym_entry__symbol(syme);
map = syme->map;

/*
* We can't annotate with just /proc/kallsyms
*/
if (map->dso->origin == DSO__ORIG_KERNEL)
return -1;

if (syme->src == NULL) {
syme->src = zalloc(sizeof(*source));
if (syme->src == NULL)
return;
return -1;
pthread_mutex_init(&syme->src->lock, NULL);
}

Expand All @@ -195,9 +204,6 @@ static void parse_source(struct sym_entry *syme)
pthread_mutex_lock(&source->lock);
goto out_assign;
}

sym = sym_entry__symbol(syme);
map = syme->map;
path = map->dso->long_name;

len = sym->end - sym->start;
Expand All @@ -209,7 +215,7 @@ static void parse_source(struct sym_entry *syme)

file = popen(command, "r");
if (!file)
return;
return -1;

pthread_mutex_lock(&source->lock);
source->lines_tail = &source->lines;
Expand Down Expand Up @@ -245,6 +251,7 @@ static void parse_source(struct sym_entry *syme)
out_assign:
sym_filter_entry = syme;
pthread_mutex_unlock(&source->lock);
return 0;
}

static void __zero_source_counters(struct sym_entry *syme)
Expand Down Expand Up @@ -991,7 +998,17 @@ static void event__process_sample(const event_t *self,
if (sym_filter_entry_sched) {
sym_filter_entry = sym_filter_entry_sched;
sym_filter_entry_sched = NULL;
parse_source(sym_filter_entry);
if (parse_source(sym_filter_entry) < 0) {
struct symbol *sym = sym_entry__symbol(sym_filter_entry);

pr_err("Can't annotate %s", sym->name);
if (sym_filter_entry->map->dso->origin == DSO__ORIG_KERNEL) {
pr_err(": No vmlinux file was found in the path:\n");
vmlinux_path__fprintf(stderr);
} else
pr_err(".\n");
exit(1);
}
}

syme = symbol__priv(al.sym);
Expand Down
25 changes: 12 additions & 13 deletions trunk/tools/perf/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@
#define NT_GNU_BUILD_ID 3
#endif

enum dso_origin {
DSO__ORIG_KERNEL = 0,
DSO__ORIG_JAVA_JIT,
DSO__ORIG_BUILD_ID_CACHE,
DSO__ORIG_FEDORA,
DSO__ORIG_UBUNTU,
DSO__ORIG_BUILDID,
DSO__ORIG_DSO,
DSO__ORIG_KMODULE,
DSO__ORIG_NOT_FOUND,
};

static void dsos__add(struct list_head *head, struct dso *dso);
static struct map *map__new2(u64 start, struct dso *dso, enum map_type type);
static int dso__load_kernel_sym(struct dso *self, struct map *map,
Expand Down Expand Up @@ -1017,7 +1005,7 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name,
}
curr_map->map_ip = identity__map_ip;
curr_map->unmap_ip = identity__map_ip;
curr_dso->origin = DSO__ORIG_KERNEL;
curr_dso->origin = self->origin;
map_groups__insert(kmap->kmaps, curr_map);
dsos__add(&dsos__kernel, curr_dso);
dso__set_loaded(curr_dso, map->type);
Expand Down Expand Up @@ -1887,6 +1875,17 @@ static int vmlinux_path__init(void)
return -1;
}

size_t vmlinux_path__fprintf(FILE *fp)
{
int i;
size_t printed = 0;

for (i = 0; i < vmlinux_path__nr_entries; ++i)
printed += fprintf(fp, "[%d] %s\n", i, vmlinux_path[i]);

return printed;
}

static int setup_list(struct strlist **list, const char *list_str,
const char *list_name)
{
Expand Down
15 changes: 15 additions & 0 deletions trunk/tools/perf/util/symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,19 @@ size_t dsos__fprintf_buildid(FILE *fp, bool with_hits);

size_t dso__fprintf_buildid(struct dso *self, FILE *fp);
size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp);

enum dso_origin {
DSO__ORIG_KERNEL = 0,
DSO__ORIG_JAVA_JIT,
DSO__ORIG_BUILD_ID_CACHE,
DSO__ORIG_FEDORA,
DSO__ORIG_UBUNTU,
DSO__ORIG_BUILDID,
DSO__ORIG_DSO,
DSO__ORIG_KMODULE,
DSO__ORIG_NOT_FOUND,
};

char dso__symtab_origin(const struct dso *self);
void dso__set_long_name(struct dso *self, char *name);
void dso__set_build_id(struct dso *self, void *build_id);
Expand All @@ -168,4 +181,6 @@ int kallsyms__parse(const char *filename, void *arg,
int symbol__init(void);
bool symbol_type__is_a(char symbol_type, enum map_type map_type);

size_t vmlinux_path__fprintf(FILE *fp);

#endif /* __PERF_SYMBOL */

0 comments on commit e409f3a

Please sign in to comment.