Skip to content

Commit

Permalink
perf stdio: Add use_callchain parameter to hists__fprintf
Browse files Browse the repository at this point in the history
It will be convenient in following patches to display hists entries
without callchains even if they are defined.

Signed-off-by: Jiri Olsa <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
olsajiri authored and acmel committed Jun 15, 2016
1 parent 8f1d1b4 commit d05e3aa
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion tools/perf/builtin-diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,8 @@ static void hists__process(struct hists *hists)
hists__precompute(hists);
hists__output_resort(hists, NULL);

hists__fprintf(hists, true, 0, 0, 0, stdout);
hists__fprintf(hists, true, 0, 0, 0, stdout,
symbol_conf.use_callchain);
}

static void data__fprintf(void)
Expand Down
3 changes: 2 additions & 1 deletion tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
continue;

hists__fprintf_nr_sample_events(hists, rep, evname, stdout);
hists__fprintf(hists, true, 0, 0, rep->min_percent, stdout);
hists__fprintf(hists, true, 0, 0, rep->min_percent, stdout,
symbol_conf.use_callchain);
fprintf(stdout, "\n\n");
}

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,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);
top->min_percent, stdout, symbol_conf.use_callchain);
}

static void prompt_integer(int *target, const char *msg)
Expand Down
10 changes: 6 additions & 4 deletions tools/perf/ui/stdio/hist.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,8 @@ static int hist_entry__hierarchy_fprintf(struct hist_entry *he,
}

static int hist_entry__fprintf(struct hist_entry *he, size_t size,
char *bf, size_t bfsz, FILE *fp)
char *bf, size_t bfsz, FILE *fp,
bool use_callchain)
{
int ret;
struct perf_hpp hpp = {
Expand All @@ -512,7 +513,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size,

ret = fprintf(fp, "%s\n", bf);

if (symbol_conf.use_callchain)
if (use_callchain)
ret += hist_entry_callchain__fprintf(he, total_period, 0, fp);

return ret;
Expand Down Expand Up @@ -709,7 +710,8 @@ static 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)
int max_cols, float min_pcnt, FILE *fp,
bool use_callchain)
{
struct perf_hpp_fmt *fmt;
struct rb_node *nd;
Expand Down Expand Up @@ -755,7 +757,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);
ret += hist_entry__fprintf(h, max_cols, line, linesz, fp, use_callchain);

if (max_rows && ++nr_rows >= max_rows)
break;
Expand Down
3 changes: 2 additions & 1 deletion tools/perf/util/hist.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ void events_stats__inc(struct events_stats *stats, u32 type);
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);
int max_cols, float min_pcnt, FILE *fp,
bool use_callchain);
size_t perf_evlist__fprintf_nr_events(struct perf_evlist *evlist, FILE *fp);

void hists__filter_by_dso(struct hists *hists);
Expand Down

0 comments on commit d05e3aa

Please sign in to comment.