aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/browsers/hists.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/ui/browsers/hists.c')
-rw-r--r--tools/perf/ui/browsers/hists.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 7ec871af3f6f..7ad11477a0f5 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -769,12 +769,15 @@ static unsigned int hist_browser__refresh(struct ui_browser *browser)
769 769
770 for (nd = browser->top; nd; nd = rb_next(nd)) { 770 for (nd = browser->top; nd; nd = rb_next(nd)) {
771 struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); 771 struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
772 float percent = h->stat.period * 100.0 / 772 u64 total = hists__total_period(h->hists);
773 hb->hists->stats.total_period; 773 float percent = 0.0;
774 774
775 if (h->filtered) 775 if (h->filtered)
776 continue; 776 continue;
777 777
778 if (total)
779 percent = h->stat.period * 100.0 / total;
780
778 if (percent < hb->min_pcnt) 781 if (percent < hb->min_pcnt)
779 continue; 782 continue;
780 783
@@ -792,8 +795,11 @@ static struct rb_node *hists__filter_entries(struct rb_node *nd,
792{ 795{
793 while (nd != NULL) { 796 while (nd != NULL) {
794 struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); 797 struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
795 float percent = h->stat.period * 100.0 / 798 u64 total = hists__total_period(hists);
796 hists->stats.total_period; 799 float percent = 0.0;
800
801 if (total)
802 percent = h->stat.period * 100.0 / total;
797 803
798 if (percent < min_pcnt) 804 if (percent < min_pcnt)
799 return NULL; 805 return NULL;
@@ -813,8 +819,11 @@ static struct rb_node *hists__filter_prev_entries(struct rb_node *nd,
813{ 819{
814 while (nd != NULL) { 820 while (nd != NULL) {
815 struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); 821 struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
816 float percent = h->stat.period * 100.0 / 822 u64 total = hists__total_period(hists);
817 hists->stats.total_period; 823 float percent = 0.0;
824
825 if (total)
826 percent = h->stat.period * 100.0 / total;
818 827
819 if (!h->filtered && percent >= min_pcnt) 828 if (!h->filtered && percent >= min_pcnt)
820 return nd; 829 return nd;
@@ -1189,6 +1198,11 @@ static int hists__browser_title(struct hists *hists, char *bf, size_t size,
1189 char buf[512]; 1198 char buf[512];
1190 size_t buflen = sizeof(buf); 1199 size_t buflen = sizeof(buf);
1191 1200
1201 if (symbol_conf.filter_relative) {
1202 nr_samples = hists->stats.nr_non_filtered_samples;
1203 nr_events = hists->stats.total_non_filtered_period;
1204 }
1205
1192 if (perf_evsel__is_group_event(evsel)) { 1206 if (perf_evsel__is_group_event(evsel)) {
1193 struct perf_evsel *pos; 1207 struct perf_evsel *pos;
1194 1208
@@ -1196,8 +1210,13 @@ static int hists__browser_title(struct hists *hists, char *bf, size_t size,
1196 ev_name = buf; 1210 ev_name = buf;
1197 1211
1198 for_each_group_member(pos, evsel) { 1212 for_each_group_member(pos, evsel) {
1199 nr_samples += pos->hists.stats.nr_events[PERF_RECORD_SAMPLE]; 1213 if (symbol_conf.filter_relative) {
1200 nr_events += pos->hists.stats.total_period; 1214 nr_samples += pos->hists.stats.nr_non_filtered_samples;
1215 nr_events += pos->hists.stats.total_non_filtered_period;
1216 } else {
1217 nr_samples += pos->hists.stats.nr_events[PERF_RECORD_SAMPLE];
1218 nr_events += pos->hists.stats.total_period;
1219 }
1201 } 1220 }
1202 } 1221 }
1203 1222