Skip to content

Commit

Permalink
perf hists: Fix recalculation of total_period when sorting entries
Browse files Browse the repository at this point in the history
We were doing parts of it in hists__collapse_resort and parts of it in
hists__output_resort, leading to a bogus total_period.

Fix it by doing just the filtering operation when collapsing because
there we know that the Zoom operations adds filters just  what is in
hists->entries, not to the new batch of entries being collapsed.

And move all the nr_entries + total_period recalculation to
hists__output_resort since we will traverse all entries anyway there.

Problem introduced when developing threaded addition of new batches
of hist_entries, i.e. post v3.1.

Reported-by: Frederic Weisbecker <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Oct 27, 2011
1 parent a9072bc commit 7928631
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions tools/perf/util/hist.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ static void __hists__collapse_resort(struct hists *hists, bool threaded)

root = hists__get_rotate_entries_in(hists);
next = rb_first(root);
hists->stats.total_period = 0;

while (next) {
n = rb_entry(next, struct hist_entry, rb_node_in);
Expand All @@ -379,7 +378,6 @@ static void __hists__collapse_resort(struct hists *hists, bool threaded)
* been set by, say, the hist_browser.
*/
hists__apply_filters(hists, n);
hists__inc_nr_entries(hists, n);
}
}
}
Expand Down Expand Up @@ -442,6 +440,7 @@ static void __hists__output_resort(struct hists *hists, bool threaded)
hists->entries = RB_ROOT;

hists->nr_entries = 0;
hists->stats.total_period = 0;
hists__reset_col_len(hists);

while (next) {
Expand Down

0 comments on commit 7928631

Please sign in to comment.