x86_64: Print modules like i386 does
[safe/jmp/linux-2.6] / tools / perf / builtin-annotate.c
index e44c54c..593ff25 100644 (file)
@@ -51,11 +51,6 @@ struct sym_priv {
        struct sym_ext  *ext;
 };
 
-static struct symbol_conf symbol_conf = {
-       .priv_size        = sizeof(struct sym_priv),
-       .try_vmlinux_path = true,
-};
-
 static const char *sym_hist_filter;
 
 static int symbol_filter(struct map *map __used, struct symbol *sym)
@@ -121,10 +116,12 @@ static void hist_hit(struct hist_entry *he, u64 ip)
                        h->ip[offset]);
 }
 
-static int hist_entry__add(struct addr_location *al, u64 count)
+static int perf_session__add_hist_entry(struct perf_session *self,
+                                       struct addr_location *al, u64 count)
 {
        bool hit;
-       struct hist_entry *he = __hist_entry__add(al, NULL, count, &hit);
+       struct hist_entry *he = __perf_session__add_hist_entry(self, al, NULL,
+                                                              count, &hit);
        if (he == NULL)
                return -ENOMEM;
        hist_hit(he, al->addr);
@@ -144,7 +141,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)
                return -1;
        }
 
-       if (hist_entry__add(&al, 1)) {
+       if (!al.filtered && perf_session__add_hist_entry(session, &al, 1)) {
                fprintf(stderr, "problem incrementing symbol count, "
                                "skipping event\n");
                return -1;
@@ -428,11 +425,11 @@ static void annotate_sym(struct hist_entry *he)
                free_source_line(he, len);
 }
 
-static void find_annotations(void)
+static void perf_session__find_annotations(struct perf_session *self)
 {
        struct rb_node *nd;
 
-       for (nd = rb_first(&output_hists); nd; nd = rb_next(nd)) {
+       for (nd = rb_first(&self->hists); nd; nd = rb_next(nd)) {
                struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node);
                struct sym_priv *priv;
 
@@ -462,10 +459,10 @@ static struct perf_event_ops event_ops = {
 
 static int __cmd_annotate(void)
 {
-       struct perf_session *session = perf_session__new(input_name, O_RDONLY,
-                                                        force, &symbol_conf);
        int ret;
+       struct perf_session *session;
 
+       session = perf_session__new(input_name, O_RDONLY, force);
        if (session == NULL)
                return -ENOMEM;
 
@@ -484,10 +481,9 @@ static int __cmd_annotate(void)
        if (verbose > 2)
                dsos__fprintf(stdout);
 
-       collapse__resort();
-       output__resort(event__total[0]);
-
-       find_annotations();
+       perf_session__collapse_resort(session);
+       perf_session__output_resort(session, session->event_total[0]);
+       perf_session__find_annotations(session);
 out_delete:
        perf_session__delete(session);
 
@@ -520,29 +516,17 @@ static const struct option options[] = {
        OPT_END()
 };
 
-static void setup_sorting(void)
+int cmd_annotate(int argc, const char **argv, const char *prefix __used)
 {
-       char *tmp, *tok, *str = strdup(sort_order);
-
-       for (tok = strtok_r(str, ", ", &tmp);
-                       tok; tok = strtok_r(NULL, ", ", &tmp)) {
-               if (sort_dimension__add(tok) < 0) {
-                       error("Unknown --sort key: `%s'", tok);
-                       usage_with_options(annotate_usage, options);
-               }
-       }
+       argc = parse_options(argc, argv, options, annotate_usage, 0);
 
-       free(str);
-}
+       symbol_conf.priv_size = sizeof(struct sym_priv);
+       symbol_conf.try_vmlinux_path = true;
 
-int cmd_annotate(int argc, const char **argv, const char *prefix __used)
-{
-       if (symbol__init(&symbol_conf) < 0)
+       if (symbol__init() < 0)
                return -1;
 
-       argc = parse_options(argc, argv, options, annotate_usage, 0);
-
-       setup_sorting();
+       setup_sorting(annotate_usage, options);
 
        if (argc) {
                /*