Skip to content

Commit

Permalink
perf hists: Add missing update on filtered stats in hists__decay_entr…
Browse files Browse the repository at this point in the history
…ies()

When a filter is used for perf top, its hists->nr_non_filtered_entries
was not updated after it removed an entry in hists__decay_entries().
Also hists->stats.total_non_filtered_period was missed too.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1398327843-31845-8-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
  • Loading branch information
Namhyung Kim authored and Jiri Olsa committed Apr 24, 2014
1 parent 820bc81 commit 3186b68
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tools/perf/util/hist.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,18 @@ static void he_stat__decay(struct he_stat *he_stat)
static bool hists__decay_entry(struct hists *hists, struct hist_entry *he)
{
u64 prev_period = he->stat.period;
u64 diff;

if (prev_period == 0)
return true;

he_stat__decay(&he->stat);

diff = prev_period - he->stat.period;

hists->stats.total_period -= diff;
if (!he->filtered)
hists->stats.total_period -= prev_period - he->stat.period;
hists->stats.total_non_filtered_period -= diff;

return he->stat.period == 0;
}
Expand All @@ -259,8 +263,11 @@ void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel)
if (sort__need_collapse)
rb_erase(&n->rb_node_in, &hists->entries_collapsed);

hist_entry__free(n);
--hists->nr_entries;
if (!n->filtered)
--hists->nr_non_filtered_entries;

hist_entry__free(n);
}
}
}
Expand Down

0 comments on commit 3186b68

Please sign in to comment.