perf tools: Adjust some verbosity levels
[safe/jmp/linux-2.6] / tools / perf / builtin-annotate.c
index 2e2855a..4fc3899 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)
@@ -102,9 +97,7 @@ static void hist_hit(struct hist_entry *he, u64 ip)
        sym_size = sym->end - sym->start;
        offset = ip - sym->start;
 
-       if (verbose)
-               fprintf(stderr, "%s: ip=%Lx\n", __func__,
-                       he->map->unmap_ip(he->map, ip));
+       pr_debug3("%s: ip=%#Lx\n", __func__, he->map->unmap_ip(he->map, ip));
 
        if (offset >= sym_size)
                return;
@@ -113,12 +106,8 @@ static void hist_hit(struct hist_entry *he, u64 ip)
        h->sum++;
        h->ip[offset]++;
 
-       if (verbose >= 3)
-               printf("%p %s: count++ [ip: %p, %08Lx] => %Ld\n",
-                       (void *)(unsigned long)he->sym->start,
-                       he->sym->name,
-                       (void *)(unsigned long)ip, ip - he->sym->start,
-                       h->ip[offset]);
+       pr_debug3("%#Lx %s: count++ [ip: %#Lx, %#Lx] => %Ld\n", he->sym->start,
+                 he->sym->name, ip, ip - he->sym->start, h->ip[offset]);
 }
 
 static int perf_session__add_hist_entry(struct perf_session *self,
@@ -137,18 +126,18 @@ static int process_sample_event(event_t *event, struct perf_session *session)
 {
        struct addr_location al;
 
-       dump_printf("(IP, %d): %d: %p\n", event->header.misc,
-                   event->ip.pid, (void *)(long)event->ip.ip);
+       dump_printf("(IP, %d): %d: %#Lx\n", event->header.misc,
+                   event->ip.pid, event->ip.ip);
 
        if (event__preprocess_sample(event, session, &al, symbol_filter) < 0) {
-               fprintf(stderr, "problem processing %d event, skipping it.\n",
-                       event->header.type);
+               pr_warning("problem processing %d event, skipping it.\n",
+                          event->header.type);
                return -1;
        }
 
-       if (perf_session__add_hist_entry(session, &al, 1)) {
-               fprintf(stderr, "problem incrementing symbol count, "
-                               "skipping event\n");
+       if (!al.filtered && perf_session__add_hist_entry(session, &al, 1)) {
+               pr_warning("problem incrementing symbol count, "
+                          "skipping event\n");
                return -1;
        }
 
@@ -383,11 +372,9 @@ static void annotate_sym(struct hist_entry *he)
        if (!filename)
                return;
 
-       if (verbose)
-               fprintf(stderr, "%s: filename=%s, sym=%s, start=%Lx, end=%Lx\n",
-                       __func__, filename, sym->name,
-                       map->unmap_ip(map, sym->start),
-                       map->unmap_ip(map, sym->end));
+       pr_debug("%s: filename=%s, sym=%s, start=%#Lx, end=%#Lx\n", __func__,
+                filename, sym->name, map->unmap_ip(map, sym->start),
+                map->unmap_ip(map, sym->end));
 
        if (full_paths)
                d_filename = filename;
@@ -456,18 +443,18 @@ static void perf_session__find_annotations(struct perf_session *self)
 }
 
 static struct perf_event_ops event_ops = {
-       .process_sample_event   = process_sample_event,
-       .process_mmap_event     = event__process_mmap,
-       .process_comm_event     = event__process_comm,
-       .process_fork_event     = event__process_task,
+       .sample = process_sample_event,
+       .mmap   = event__process_mmap,
+       .comm   = event__process_comm,
+       .fork   = event__process_task,
 };
 
 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;
 
@@ -523,11 +510,14 @@ static const struct option options[] = {
 
 int cmd_annotate(int argc, const char **argv, const char *prefix __used)
 {
-       if (symbol__init(&symbol_conf) < 0)
-               return -1;
-
        argc = parse_options(argc, argv, options, annotate_usage, 0);
 
+       symbol_conf.priv_size = sizeof(struct sym_priv);
+       symbol_conf.try_vmlinux_path = true;
+
+       if (symbol__init() < 0)
+               return -1;
+
        setup_sorting(annotate_usage, options);
 
        if (argc) {
@@ -544,9 +534,8 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __used)
        setup_pager();
 
        if (field_sep && *field_sep == '.') {
-               fputs("'.' is the only non valid --field-separator argument\n",
-                               stderr);
-               exit(129);
+               pr_err("'.' is the only non valid --field-separator argument\n");
+               return -1;
        }
 
        return __cmd_annotate();