diff options
| author | Namhyung Kim <namhyung.kim@lge.com> | 2013-10-11 01:15:38 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-10-23 14:48:24 -0400 |
| commit | c1fb5651bb40f9efaf32d280f39e06df7e352673 (patch) | |
| tree | d4bbd2fadb55737c20e96ed0f2db9101c9ba24a0 /tools/perf | |
| parent | 4d3001fdfdfacd2b35ee74ff0f037274eeebd3f6 (diff) | |
perf tools: Show progress on histogram collapsing
It can take quite amount of time so add progress bar UI to inform user.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1381468543-25334-4-git-send-email-namhyung@kernel.org
[ perf_progress -> ui_progress ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
| -rw-r--r-- | tools/perf/builtin-annotate.c | 2 | ||||
| -rw-r--r-- | tools/perf/builtin-diff.c | 2 | ||||
| -rw-r--r-- | tools/perf/builtin-report.c | 10 | ||||
| -rw-r--r-- | tools/perf/builtin-top.c | 4 | ||||
| -rw-r--r-- | tools/perf/tests/hists_link.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/hist.c | 5 | ||||
| -rw-r--r-- | tools/perf/util/hist.h | 3 |
7 files changed, 20 insertions, 8 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 17c6b494e8cc..6c5ae57831f6 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
| @@ -247,7 +247,7 @@ static int __cmd_annotate(struct perf_annotate *ann) | |||
| 247 | 247 | ||
| 248 | if (nr_samples > 0) { | 248 | if (nr_samples > 0) { |
| 249 | total_nr_samples += nr_samples; | 249 | total_nr_samples += nr_samples; |
| 250 | hists__collapse_resort(hists); | 250 | hists__collapse_resort(hists, NULL); |
| 251 | hists__output_resort(hists); | 251 | hists__output_resort(hists); |
| 252 | 252 | ||
| 253 | if (symbol_conf.event_group && | 253 | if (symbol_conf.event_group && |
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 9c828881714c..b605009e803f 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
| @@ -369,7 +369,7 @@ static void perf_evlist__collapse_resort(struct perf_evlist *evlist) | |||
| 369 | list_for_each_entry(evsel, &evlist->entries, node) { | 369 | list_for_each_entry(evsel, &evlist->entries, node) { |
| 370 | struct hists *hists = &evsel->hists; | 370 | struct hists *hists = &evsel->hists; |
| 371 | 371 | ||
| 372 | hists__collapse_resort(hists); | 372 | hists__collapse_resort(hists, NULL); |
| 373 | } | 373 | } |
| 374 | } | 374 | } |
| 375 | 375 | ||
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index e3598a456017..98d3891392e2 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
| @@ -496,6 +496,7 @@ static int __cmd_report(struct perf_report *rep) | |||
| 496 | struct map *kernel_map; | 496 | struct map *kernel_map; |
| 497 | struct kmap *kernel_kmap; | 497 | struct kmap *kernel_kmap; |
| 498 | const char *help = "For a higher level overview, try: perf report --sort comm,dso"; | 498 | const char *help = "For a higher level overview, try: perf report --sort comm,dso"; |
| 499 | struct ui_progress prog; | ||
| 499 | struct perf_data_file *file = session->file; | 500 | struct perf_data_file *file = session->file; |
| 500 | 501 | ||
| 501 | signal(SIGINT, sig_handler); | 502 | signal(SIGINT, sig_handler); |
| @@ -558,13 +559,19 @@ static int __cmd_report(struct perf_report *rep) | |||
| 558 | } | 559 | } |
| 559 | 560 | ||
| 560 | nr_samples = 0; | 561 | nr_samples = 0; |
| 562 | list_for_each_entry(pos, &session->evlist->entries, node) | ||
| 563 | nr_samples += pos->hists.nr_entries; | ||
| 564 | |||
| 565 | ui_progress__init(&prog, nr_samples, "Merging related events..."); | ||
| 566 | |||
| 567 | nr_samples = 0; | ||
| 561 | list_for_each_entry(pos, &session->evlist->entries, node) { | 568 | list_for_each_entry(pos, &session->evlist->entries, node) { |
| 562 | struct hists *hists = &pos->hists; | 569 | struct hists *hists = &pos->hists; |
| 563 | 570 | ||
| 564 | if (pos->idx == 0) | 571 | if (pos->idx == 0) |
| 565 | hists->symbol_filter_str = rep->symbol_filter_str; | 572 | hists->symbol_filter_str = rep->symbol_filter_str; |
| 566 | 573 | ||
| 567 | hists__collapse_resort(hists); | 574 | hists__collapse_resort(hists, &prog); |
| 568 | nr_samples += hists->stats.nr_events[PERF_RECORD_SAMPLE]; | 575 | nr_samples += hists->stats.nr_events[PERF_RECORD_SAMPLE]; |
| 569 | 576 | ||
| 570 | /* Non-group events are considered as leader */ | 577 | /* Non-group events are considered as leader */ |
| @@ -576,6 +583,7 @@ static int __cmd_report(struct perf_report *rep) | |||
| 576 | hists__link(leader_hists, hists); | 583 | hists__link(leader_hists, hists); |
| 577 | } | 584 | } |
| 578 | } | 585 | } |
| 586 | ui_progress__finish(); | ||
| 579 | 587 | ||
| 580 | if (session_done()) | 588 | if (session_done()) |
| 581 | return 0; | 589 | return 0; |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 386d83324a8d..76c9264ed070 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
| @@ -286,7 +286,7 @@ static void perf_top__print_sym_table(struct perf_top *top) | |||
| 286 | return; | 286 | return; |
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | hists__collapse_resort(&top->sym_evsel->hists); | 289 | hists__collapse_resort(&top->sym_evsel->hists, NULL); |
| 290 | hists__output_resort(&top->sym_evsel->hists); | 290 | hists__output_resort(&top->sym_evsel->hists); |
| 291 | hists__decay_entries(&top->sym_evsel->hists, | 291 | hists__decay_entries(&top->sym_evsel->hists, |
| 292 | top->hide_user_symbols, | 292 | top->hide_user_symbols, |
| @@ -552,7 +552,7 @@ static void perf_top__sort_new_samples(void *arg) | |||
| 552 | if (t->evlist->selected != NULL) | 552 | if (t->evlist->selected != NULL) |
| 553 | t->sym_evsel = t->evlist->selected; | 553 | t->sym_evsel = t->evlist->selected; |
| 554 | 554 | ||
| 555 | hists__collapse_resort(&t->sym_evsel->hists); | 555 | hists__collapse_resort(&t->sym_evsel->hists, NULL); |
| 556 | hists__output_resort(&t->sym_evsel->hists); | 556 | hists__output_resort(&t->sym_evsel->hists); |
| 557 | hists__decay_entries(&t->sym_evsel->hists, | 557 | hists__decay_entries(&t->sym_evsel->hists, |
| 558 | t->hide_user_symbols, | 558 | t->hide_user_symbols, |
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c index 025503a22ff7..b51abcb2c243 100644 --- a/tools/perf/tests/hists_link.c +++ b/tools/perf/tests/hists_link.c | |||
| @@ -467,7 +467,7 @@ int test__hists_link(void) | |||
| 467 | goto out; | 467 | goto out; |
| 468 | 468 | ||
| 469 | list_for_each_entry(evsel, &evlist->entries, node) { | 469 | list_for_each_entry(evsel, &evlist->entries, node) { |
| 470 | hists__collapse_resort(&evsel->hists); | 470 | hists__collapse_resort(&evsel->hists, NULL); |
| 471 | 471 | ||
| 472 | if (verbose > 2) | 472 | if (verbose > 2) |
| 473 | print_hists(&evsel->hists); | 473 | print_hists(&evsel->hists); |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index f0b863ef4896..7e80253074b0 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
| @@ -399,6 +399,7 @@ static struct hist_entry *add_hist_entry(struct hists *hists, | |||
| 399 | if (!he) | 399 | if (!he) |
| 400 | return NULL; | 400 | return NULL; |
| 401 | 401 | ||
| 402 | hists->nr_entries++; | ||
| 402 | rb_link_node(&he->rb_node_in, parent, p); | 403 | rb_link_node(&he->rb_node_in, parent, p); |
| 403 | rb_insert_color(&he->rb_node_in, hists->entries_in); | 404 | rb_insert_color(&he->rb_node_in, hists->entries_in); |
| 404 | out: | 405 | out: |
| @@ -604,7 +605,7 @@ static void hists__apply_filters(struct hists *hists, struct hist_entry *he) | |||
| 604 | hists__filter_entry_by_symbol(hists, he); | 605 | hists__filter_entry_by_symbol(hists, he); |
| 605 | } | 606 | } |
| 606 | 607 | ||
| 607 | void hists__collapse_resort(struct hists *hists) | 608 | void hists__collapse_resort(struct hists *hists, struct ui_progress *prog) |
| 608 | { | 609 | { |
| 609 | struct rb_root *root; | 610 | struct rb_root *root; |
| 610 | struct rb_node *next; | 611 | struct rb_node *next; |
| @@ -631,6 +632,8 @@ void hists__collapse_resort(struct hists *hists) | |||
| 631 | */ | 632 | */ |
| 632 | hists__apply_filters(hists, n); | 633 | hists__apply_filters(hists, n); |
| 633 | } | 634 | } |
| 635 | if (prog) | ||
| 636 | ui_progress__update(prog, 1); | ||
| 634 | } | 637 | } |
| 635 | } | 638 | } |
| 636 | 639 | ||
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 20b175808cd3..0c7ce8bb8eba 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <pthread.h> | 5 | #include <pthread.h> |
| 6 | #include "callchain.h" | 6 | #include "callchain.h" |
| 7 | #include "header.h" | 7 | #include "header.h" |
| 8 | #include "ui/progress.h" | ||
| 8 | 9 | ||
| 9 | extern struct callchain_param callchain_param; | 10 | extern struct callchain_param callchain_param; |
| 10 | 11 | ||
| @@ -108,7 +109,7 @@ struct hist_entry *__hists__add_mem_entry(struct hists *self, | |||
| 108 | u64 weight); | 109 | u64 weight); |
| 109 | 110 | ||
| 110 | void hists__output_resort(struct hists *self); | 111 | void hists__output_resort(struct hists *self); |
| 111 | void hists__collapse_resort(struct hists *self); | 112 | void hists__collapse_resort(struct hists *self, struct ui_progress *prog); |
| 112 | 113 | ||
| 113 | void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel); | 114 | void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel); |
| 114 | void hists__output_recalc_col_len(struct hists *hists, int max_rows); | 115 | void hists__output_recalc_col_len(struct hists *hists, int max_rows); |
