aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/browsers/annotate.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2017-10-11 11:01:49 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-11-16 12:49:45 -0500
commitb15636c62f3a32a8560ea6a32245ec49edd60c6b (patch)
treebe135be921c59b346cc74e1de7c4e36c8ad0d9be /tools/perf/ui/browsers/annotate.c
parent3ab6db8d0f3b19b93a8de25e3b7ab5fdaac47679 (diff)
perf annotate browser: Do not pass nr_events in disasm_rb_tree__insert
We now keep samples_nr in struct annotation_line, so there's no need to pass nr_events to disasm_rb_tree__insert function. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20171011150158.11895-27-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/browsers/annotate.c')
-rw-r--r--tools/perf/ui/browsers/annotate.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 5d99429a03bc..67e5955b3c6f 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -356,12 +356,11 @@ static unsigned int annotate_browser__refresh(struct ui_browser *browser)
356 return ret; 356 return ret;
357} 357}
358 358
359static int disasm__cmp(struct annotation_line *a, 359static int disasm__cmp(struct annotation_line *a, struct annotation_line *b)
360 struct annotation_line *b, int nr_pcnt)
361{ 360{
362 int i; 361 int i;
363 362
364 for (i = 0; i < nr_pcnt; i++) { 363 for (i = 0; i < a->samples_nr; i++) {
365 if (a->samples[i].percent == b->samples[i].percent) 364 if (a->samples[i].percent == b->samples[i].percent)
366 continue; 365 continue;
367 return a->samples[i].percent < b->samples[i].percent; 366 return a->samples[i].percent < b->samples[i].percent;
@@ -369,8 +368,7 @@ static int disasm__cmp(struct annotation_line *a,
369 return 0; 368 return 0;
370} 369}
371 370
372static void disasm_rb_tree__insert(struct rb_root *root, struct annotation_line *al, 371static void disasm_rb_tree__insert(struct rb_root *root, struct annotation_line *al)
373 int nr_events)
374{ 372{
375 struct rb_node **p = &root->rb_node; 373 struct rb_node **p = &root->rb_node;
376 struct rb_node *parent = NULL; 374 struct rb_node *parent = NULL;
@@ -380,7 +378,7 @@ static void disasm_rb_tree__insert(struct rb_root *root, struct annotation_line
380 parent = *p; 378 parent = *p;
381 l = rb_entry(parent, struct annotation_line, rb_node); 379 l = rb_entry(parent, struct annotation_line, rb_node);
382 380
383 if (disasm__cmp(al, l, nr_events)) 381 if (disasm__cmp(al, l))
384 p = &(*p)->rb_left; 382 p = &(*p)->rb_left;
385 else 383 else
386 p = &(*p)->rb_right; 384 p = &(*p)->rb_right;
@@ -452,7 +450,7 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser,
452 continue; 450 continue;
453 } 451 }
454 452
455 for (i = 0; i < browser->nr_events; i++) { 453 for (i = 0; i < pos->al.samples_nr; i++) {
456 struct annotation_data *sample = &pos->al.samples[i]; 454 struct annotation_data *sample = &pos->al.samples[i];
457 455
458 if (max_percent < sample->percent) 456 if (max_percent < sample->percent)
@@ -463,8 +461,7 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser,
463 RB_CLEAR_NODE(&pos->al.rb_node); 461 RB_CLEAR_NODE(&pos->al.rb_node);
464 continue; 462 continue;
465 } 463 }
466 disasm_rb_tree__insert(&browser->entries, &pos->al, 464 disasm_rb_tree__insert(&browser->entries, &pos->al);
467 browser->nr_events);
468 } 465 }
469 pthread_mutex_unlock(&notes->lock); 466 pthread_mutex_unlock(&notes->lock);
470 467