diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-27 07:19:48 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-27 07:19:48 -0400 |
commit | 7928631a66c884b18f827fbd1b63cd80198f004b (patch) | |
tree | 08c0c4b964a58fb461b42903dcadbb2fe22bb8dc /tools | |
parent | a9072bc0b0af991e274b699f17bc50cf201e377b (diff) |
perf hists: Fix recalculation of total_period when sorting entries
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 <fweisbec@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-8xyh165h7hmwy0696hu25en6@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/hist.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index f6a993963a1..a36a3fa81ff 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -365,7 +365,6 @@ static void __hists__collapse_resort(struct hists *hists, bool threaded) | |||
365 | 365 | ||
366 | root = hists__get_rotate_entries_in(hists); | 366 | root = hists__get_rotate_entries_in(hists); |
367 | next = rb_first(root); | 367 | next = rb_first(root); |
368 | hists->stats.total_period = 0; | ||
369 | 368 | ||
370 | while (next) { | 369 | while (next) { |
371 | n = rb_entry(next, struct hist_entry, rb_node_in); | 370 | n = rb_entry(next, struct hist_entry, rb_node_in); |
@@ -379,7 +378,6 @@ static void __hists__collapse_resort(struct hists *hists, bool threaded) | |||
379 | * been set by, say, the hist_browser. | 378 | * been set by, say, the hist_browser. |
380 | */ | 379 | */ |
381 | hists__apply_filters(hists, n); | 380 | hists__apply_filters(hists, n); |
382 | hists__inc_nr_entries(hists, n); | ||
383 | } | 381 | } |
384 | } | 382 | } |
385 | } | 383 | } |
@@ -442,6 +440,7 @@ static void __hists__output_resort(struct hists *hists, bool threaded) | |||
442 | hists->entries = RB_ROOT; | 440 | hists->entries = RB_ROOT; |
443 | 441 | ||
444 | hists->nr_entries = 0; | 442 | hists->nr_entries = 0; |
443 | hists->stats.total_period = 0; | ||
445 | hists__reset_col_len(hists); | 444 | hists__reset_col_len(hists); |
446 | 445 | ||
447 | while (next) { | 446 | while (next) { |