Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf hists: Clarify callchain disabling when available

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>

+11 -11
+2 -2
tools/perf/builtin-c2c.c
··· 2193 2193 fprintf(out, "%s\n", bf); 2194 2194 fprintf(out, " -------------------------------------------------------------\n"); 2195 2195 2196 - hists__fprintf(&c2c_hists->hists, false, 0, 0, 0, out, true); 2196 + hists__fprintf(&c2c_hists->hists, false, 0, 0, 0, out, false); 2197 2197 } 2198 2198 2199 2199 static void print_pareto(FILE *out) ··· 2268 2268 fprintf(out, "=================================================\n"); 2269 2269 fprintf(out, "#\n"); 2270 2270 2271 - hists__fprintf(&c2c.hists.hists, true, 0, 0, 0, stdout, false); 2271 + hists__fprintf(&c2c.hists.hists, true, 0, 0, 0, stdout, true); 2272 2272 2273 2273 fprintf(out, "\n"); 2274 2274 fprintf(out, "=================================================\n");
+1 -1
tools/perf/builtin-diff.c
··· 696 696 hists__output_resort(hists, NULL); 697 697 698 698 hists__fprintf(hists, !quiet, 0, 0, 0, stdout, 699 - symbol_conf.use_callchain); 699 + !symbol_conf.use_callchain); 700 700 } 701 701 702 702 static void data__fprintf(void)
+2 -2
tools/perf/builtin-report.c
··· 478 478 479 479 hists__fprintf_nr_sample_events(hists, rep, evname, stdout); 480 480 hists__fprintf(hists, !quiet, 0, 0, rep->min_percent, stdout, 481 - symbol_conf.use_callchain || 482 - symbol_conf.show_branchflag_count); 481 + !(symbol_conf.use_callchain || 482 + symbol_conf.show_branchflag_count)); 483 483 fprintf(stdout, "\n\n"); 484 484 } 485 485
+1 -1
tools/perf/builtin-top.c
··· 307 307 hists__output_recalc_col_len(hists, top->print_entries - printed); 308 308 putchar('\n'); 309 309 hists__fprintf(hists, false, top->print_entries - printed, win_width, 310 - top->min_percent, stdout, symbol_conf.use_callchain); 310 + top->min_percent, stdout, !symbol_conf.use_callchain); 311 311 } 312 312 313 313 static void prompt_integer(int *target, const char *msg)
+4 -4
tools/perf/ui/stdio/hist.c
··· 529 529 530 530 static int hist_entry__fprintf(struct hist_entry *he, size_t size, 531 531 char *bf, size_t bfsz, FILE *fp, 532 - bool use_callchain) 532 + bool ignore_callchains) 533 533 { 534 534 int ret; 535 535 int callchain_ret = 0; ··· 550 550 551 551 ret = fprintf(fp, "%s\n", bf); 552 552 553 - if (hist_entry__has_callchains(he) && use_callchain) 553 + if (hist_entry__has_callchains(he) && !ignore_callchains) 554 554 callchain_ret = hist_entry_callchain__fprintf(he, total_period, 555 555 0, fp); 556 556 ··· 755 755 756 756 size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, 757 757 int max_cols, float min_pcnt, FILE *fp, 758 - bool use_callchain) 758 + bool ignore_callchains) 759 759 { 760 760 struct rb_node *nd; 761 761 size_t ret = 0; ··· 799 799 if (percent < min_pcnt) 800 800 continue; 801 801 802 - ret += hist_entry__fprintf(h, max_cols, line, linesz, fp, use_callchain); 802 + ret += hist_entry__fprintf(h, max_cols, line, linesz, fp, ignore_callchains); 803 803 804 804 if (max_rows && ++nr_rows >= max_rows) 805 805 break;
+1 -1
tools/perf/util/hist.h
··· 181 181 182 182 size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, 183 183 int max_cols, float min_pcnt, FILE *fp, 184 - bool use_callchain); 184 + bool ignore_callchains); 185 185 size_t perf_evlist__fprintf_nr_events(struct perf_evlist *evlist, FILE *fp); 186 186 187 187 void hists__filter_by_dso(struct hists *hists);