perf callchain: Honor hide_unresolved
authorNamhyung Kim <namhyung@kernel.org>
Thu, 26 Nov 2015 07:08:20 +0000 (16:08 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 26 Nov 2015 16:19:39 +0000 (13:19 -0300)
If user requested to hide unresolved entries, skip unresolved callchains
as well as hist entries.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1448521700-32062-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-report.c
tools/perf/util/machine.c
tools/perf/util/symbol.h

index 14428342b47b35489d6141b3f9eee933f815678b..8a9c6908f54ed658f4d1f548796cde72413ddf29 100644 (file)
@@ -45,7 +45,6 @@ struct report {
        struct perf_tool        tool;
        struct perf_session     *session;
        bool                    use_tui, use_gtk, use_stdio;
-       bool                    hide_unresolved;
        bool                    dont_use_callchains;
        bool                    show_full_info;
        bool                    show_threads;
@@ -146,7 +145,7 @@ static int process_sample_event(struct perf_tool *tool,
        struct hist_entry_iter iter = {
                .evsel                  = evsel,
                .sample                 = sample,
-               .hide_unresolved        = rep->hide_unresolved,
+               .hide_unresolved        = symbol_conf.hide_unresolved,
                .add_entry_cb           = hist_iter__report_callback,
        };
        int ret = 0;
@@ -157,7 +156,7 @@ static int process_sample_event(struct perf_tool *tool,
                return -1;
        }
 
-       if (rep->hide_unresolved && al.sym == NULL)
+       if (symbol_conf.hide_unresolved && al.sym == NULL)
                goto out_put;
 
        if (rep->cpu_list && !test_bit(sample->cpu, rep->cpu_bitmap))
@@ -740,7 +739,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
        OPT_STRING_NOEMPTY('t', "field-separator", &symbol_conf.field_sep, "separator",
                   "separator for columns, no spaces will be added between "
                   "columns '.' is reserved."),
-       OPT_BOOLEAN('U', "hide-unresolved", &report.hide_unresolved,
+       OPT_BOOLEAN('U', "hide-unresolved", &symbol_conf.hide_unresolved,
                    "Only display entries resolved to a symbol"),
        OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory",
                    "Look for files with symbols relative to this directory"),
index 7f5071a4d9aa19d8355b64a93449fe45f8cf38d2..f0019b72db48f8f31c5cdc7d3a2fc853f98a91ae 100644 (file)
@@ -1618,6 +1618,8 @@ static int add_callchain_ip(struct thread *thread,
                }
        }
 
+       if (symbol_conf.hide_unresolved && al.sym == NULL)
+               return 0;
        return callchain_cursor_append(&callchain_cursor, al.addr, al.map, al.sym);
 }
 
@@ -1872,6 +1874,9 @@ check_calls:
 static int unwind_entry(struct unwind_entry *entry, void *arg)
 {
        struct callchain_cursor *cursor = arg;
+
+       if (symbol_conf.hide_unresolved && entry->sym == NULL)
+               return 0;
        return callchain_cursor_append(cursor, entry->ip,
                                       entry->map, entry->sym);
 }
index dcd786e364f2da1385c2f78803fe1770071ce609..857f707ac12bb0b6c27f056567d790ab0e76bb21 100644 (file)
@@ -108,7 +108,8 @@ struct symbol_conf {
                        show_hist_headers,
                        branch_callstack,
                        has_filter,
-                       show_ref_callgraph;
+                       show_ref_callgraph,
+                       hide_unresolved;
        const char      *vmlinux_name,
                        *kallsyms_name,
                        *source_prefix,