diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 992b18bdd723..ca41187525ed 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -509,7 +509,7 @@ static int perf_evlist__tty_browse_hists(struct evlist *evlist, if (rep->total_cycles_mode) { report__browse_block_hists(&rep->block_reports[i++].hist, - 0, pos); + rep->min_percent, pos); continue; } diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index 655ef7708cd0..132056c7d5b7 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c @@ -15,6 +15,7 @@ #include "../../util/srcline.h" #include "../../util/string2.h" #include "../../util/thread.h" +#include "../../util/block-info.h" #include #include @@ -856,7 +857,11 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, if (h->filtered) continue; - percent = hist_entry__get_percent_limit(h); + if (symbol_conf.report_individual_block) + percent = block_info__total_cycles_percent(h); + else + percent = hist_entry__get_percent_limit(h); + if (percent < min_pcnt) continue; diff --git a/tools/perf/util/block-info.c b/tools/perf/util/block-info.c index ba891751a6ed..597d1205fa6c 100644 --- a/tools/perf/util/block-info.c +++ b/tools/perf/util/block-info.c @@ -454,3 +454,13 @@ int report__browse_block_hists(struct block_hist *bh, float min_percent, return 0; } + +float block_info__total_cycles_percent(struct hist_entry *he) +{ + struct block_info *bi = he->block_info; + + if (bi->total_cycles) + return bi->cycles * 100.0 / bi->total_cycles; + + return 0.0; +} diff --git a/tools/perf/util/block-info.h b/tools/perf/util/block-info.h index 8309297a6e8f..e4d20bccd9b6 100644 --- a/tools/perf/util/block-info.h +++ b/tools/perf/util/block-info.h @@ -73,4 +73,6 @@ struct block_report *block_info__create_report(struct evlist *evlist, int report__browse_block_hists(struct block_hist *bh, float min_percent, struct evsel *evsel); +float block_info__total_cycles_percent(struct hist_entry *he); + #endif /* __PERF_BLOCK_H */