Skip to content

Commit

Permalink
perf top: Fix live annotation in the --stdio interface
Browse files Browse the repository at this point in the history
In the old --stdio interface the annotation is done just after one
selects a symbol, while in --tui, now the default when the required libs
are installed, we annotate all symbols with samples so that when
annotation is asked we see what happened recently on that symbol.

To achieve that the --stdio variant checks if the hist_entry being
processed is the one selected by the user via the 's' hotkey. What
happens now that we share the hist_entry abstractions with 'perf report'
is that for minimizing locking contention multiple rb_trees are used,
one for collecting the samples and other to browse/show them after
resorting it by number of samples and decay them, which is done
periodically.

So the simple test in record_precise_ip doesn't work as we move
hist_entries between those rb_trees. To fix it just check that the
underlying struct symbol associated with those hist_entries is the same.

Reported-by: Mike Galbraith <[email protected]>
Tested-by: Mike Galbraith <[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 Nov 3, 2011
1 parent 104268a commit f9e3d4b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ static void record_precise_ip(struct hist_entry *he, int counter, u64 ip)
struct symbol *sym;

if (he == NULL || he->ms.sym == NULL ||
(he != top.sym_filter_entry && use_browser != 1))
((top.sym_filter_entry == NULL ||
top.sym_filter_entry->ms.sym != he->ms.sym) && use_browser != 1))
return;

sym = he->ms.sym;
Expand Down

0 comments on commit f9e3d4b

Please sign in to comment.