perf hists: Clarify callchain disabling when available
authorArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 20 Jun 2018 18:58:20 +0000 (15:58 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 24 Jul 2018 17:37:33 +0000 (14:37 -0300)
We want to allow having mixed events with/without callchains, not
using a global flag to show callchains, but allowing supressing
callchains when they are present.

So invert the logic of the last parameter to hists__fprint() to
that effect.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-ohqyisr6qge79qa95ojslptx@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-c2c.c
tools/perf/builtin-diff.c
tools/perf/builtin-report.c
tools/perf/builtin-top.c
tools/perf/ui/stdio/hist.c
tools/perf/util/hist.h

index 6a8738f..f2ea85e 100644 (file)
@@ -2193,7 +2193,7 @@ static void print_cacheline(struct c2c_hists *c2c_hists,
        fprintf(out, "%s\n", bf);
        fprintf(out, "  -------------------------------------------------------------\n");
 
-       hists__fprintf(&c2c_hists->hists, false, 0, 0, 0, out, true);
+       hists__fprintf(&c2c_hists->hists, false, 0, 0, 0, out, false);
 }
 
 static void print_pareto(FILE *out)
@@ -2268,7 +2268,7 @@ static void perf_c2c__hists_fprintf(FILE *out, struct perf_session *session)
        fprintf(out, "=================================================\n");
        fprintf(out, "#\n");
 
-       hists__fprintf(&c2c.hists.hists, true, 0, 0, 0, stdout, false);
+       hists__fprintf(&c2c.hists.hists, true, 0, 0, 0, stdout, true);
 
        fprintf(out, "\n");
        fprintf(out, "=================================================\n");
index d660cb7..39db2ee 100644 (file)
@@ -696,7 +696,7 @@ static void hists__process(struct hists *hists)
        hists__output_resort(hists, NULL);
 
        hists__fprintf(hists, !quiet, 0, 0, 0, stdout,
-                      symbol_conf.use_callchain);
+                      !symbol_conf.use_callchain);
 }
 
 static void data__fprintf(void)
index c04dc7b..02f7a3c 100644 (file)
@@ -478,8 +478,8 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
 
                hists__fprintf_nr_sample_events(hists, rep, evname, stdout);
                hists__fprintf(hists, !quiet, 0, 0, rep->min_percent, stdout,
-                              symbol_conf.use_callchain ||
-                              symbol_conf.show_branchflag_count);
+                              !(symbol_conf.use_callchain ||
+                                symbol_conf.show_branchflag_count));
                fprintf(stdout, "\n\n");
        }
 
index ffdc276..d21d875 100644 (file)
@@ -307,7 +307,7 @@ static void perf_top__print_sym_table(struct perf_top *top)
        hists__output_recalc_col_len(hists, top->print_entries - printed);
        putchar('\n');
        hists__fprintf(hists, false, top->print_entries - printed, win_width,
-                      top->min_percent, stdout, symbol_conf.use_callchain);
+                      top->min_percent, stdout, !symbol_conf.use_callchain);
 }
 
 static void prompt_integer(int *target, const char *msg)
index 69b7a28..74c4ae1 100644 (file)
@@ -529,7 +529,7 @@ out:
 
 static int hist_entry__fprintf(struct hist_entry *he, size_t size,
                               char *bf, size_t bfsz, FILE *fp,
-                              bool use_callchain)
+                              bool ignore_callchains)
 {
        int ret;
        int callchain_ret = 0;
@@ -550,7 +550,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size,
 
        ret = fprintf(fp, "%s\n", bf);
 
-       if (hist_entry__has_callchains(he) && use_callchain)
+       if (hist_entry__has_callchains(he) && !ignore_callchains)
                callchain_ret = hist_entry_callchain__fprintf(he, total_period,
                                                              0, fp);
 
@@ -755,7 +755,7 @@ int hists__fprintf_headers(struct hists *hists, FILE *fp)
 
 size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
                      int max_cols, float min_pcnt, FILE *fp,
-                     bool use_callchain)
+                     bool ignore_callchains)
 {
        struct rb_node *nd;
        size_t ret = 0;
@@ -799,7 +799,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
                if (percent < min_pcnt)
                        continue;
 
-               ret += hist_entry__fprintf(h, max_cols, line, linesz, fp, use_callchain);
+               ret += hist_entry__fprintf(h, max_cols, line, linesz, fp, ignore_callchains);
 
                if (max_rows && ++nr_rows >= max_rows)
                        break;
index 73049f7..3badd7f 100644 (file)
@@ -181,7 +181,7 @@ size_t events_stats__fprintf(struct events_stats *stats, FILE *fp);
 
 size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
                      int max_cols, float min_pcnt, FILE *fp,
-                     bool use_callchain);
+                     bool ignore_callchains);
 size_t perf_evlist__fprintf_nr_events(struct perf_evlist *evlist, FILE *fp);
 
 void hists__filter_by_dso(struct hists *hists);