From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753193Ab3JKFPv (ORCPT ); Fri, 11 Oct 2013 01:15:51 -0400 Received: from LGEMRELSE1Q.lge.com ([156.147.1.111]:64088 "EHLO LGEMRELSE1Q.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751527Ab3JKFPs (ORCPT ); Fri, 11 Oct 2013 01:15:48 -0400 X-AuditID: 9c93016f-b7c63ae00000696f-1e-525789811c73 From: Namhyung Kim To: Arnaldo Carvalho de Melo Cc: Peter Zijlstra , Paul Mackerras , Ingo Molnar , Namhyung Kim , LKML , Linus Torvalds , Frederic Weisbecker , Jiri Olsa Subject: [PATCH 3/8] perf tools: Show progress on histogram collapsing Date: Fri, 11 Oct 2013 14:15:38 +0900 Message-Id: <1381468543-25334-4-git-send-email-namhyung@kernel.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1381468543-25334-1-git-send-email-namhyung@kernel.org> References: <1381468543-25334-1-git-send-email-namhyung@kernel.org> X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Namhyung Kim It can take quite amount of time so add progress bar UI to inform user. Cc: Frederic Weisbecker Signed-off-by: Namhyung Kim --- tools/perf/builtin-annotate.c | 2 +- tools/perf/builtin-diff.c | 2 +- tools/perf/builtin-report.c | 10 +++++++++- tools/perf/builtin-top.c | 4 ++-- tools/perf/tests/hists_link.c | 2 +- tools/perf/util/hist.c | 5 ++++- 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 ddde4074fd91..a732a6caeffe 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -246,7 +246,7 @@ static int __cmd_annotate(struct perf_annotate *ann) if (nr_samples > 0) { total_nr_samples += nr_samples; - hists__collapse_resort(hists); + hists__collapse_resort(hists, NULL); hists__output_resort(hists); if (symbol_conf.event_group && diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index f28799e94f2a..f4ab7d210105 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -367,7 +367,7 @@ static void perf_evlist__collapse_resort(struct perf_evlist *evlist) list_for_each_entry(evsel, &evlist->entries, node) { struct hists *hists = &evsel->hists; - hists__collapse_resort(hists); + hists__collapse_resort(hists, NULL); } } diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index c902229f3f94..83920612984a 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -489,6 +489,7 @@ static int __cmd_report(struct perf_report *rep) struct map *kernel_map; struct kmap *kernel_kmap; const char *help = "For a higher level overview, try: perf report --sort comm,dso"; + struct perf_progress prog; signal(SIGINT, sig_handler); @@ -550,13 +551,19 @@ static int __cmd_report(struct perf_report *rep) } nr_samples = 0; + list_for_each_entry(pos, &session->evlist->entries, node) + nr_samples += pos->hists.nr_entries; + + ui_progress__setup(&prog, nr_samples); + + nr_samples = 0; list_for_each_entry(pos, &session->evlist->entries, node) { struct hists *hists = &pos->hists; if (pos->idx == 0) hists->symbol_filter_str = rep->symbol_filter_str; - hists__collapse_resort(hists); + hists__collapse_resort(hists, &prog); nr_samples += hists->stats.nr_events[PERF_RECORD_SAMPLE]; /* Non-group events are considered as leader */ @@ -568,6 +575,7 @@ static int __cmd_report(struct perf_report *rep) hists__link(leader_hists, hists); } } + ui_progress__finish(); if (nr_samples == 0) { ui__error("The %s file has no samples!\n", session->filename); diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index cf4bba07175a..0cb077f823de 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -287,7 +287,7 @@ static void perf_top__print_sym_table(struct perf_top *top) return; } - hists__collapse_resort(&top->sym_evsel->hists); + hists__collapse_resort(&top->sym_evsel->hists, NULL); hists__output_resort(&top->sym_evsel->hists); hists__decay_entries(&top->sym_evsel->hists, top->hide_user_symbols, @@ -553,7 +553,7 @@ static void perf_top__sort_new_samples(void *arg) if (t->evlist->selected != NULL) t->sym_evsel = t->evlist->selected; - hists__collapse_resort(&t->sym_evsel->hists); + hists__collapse_resort(&t->sym_evsel->hists, NULL); hists__output_resort(&t->sym_evsel->hists); hists__decay_entries(&t->sym_evsel->hists, t->hide_user_symbols, diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c index 4228ffc0d968..3b5faaa5c8cf 100644 --- a/tools/perf/tests/hists_link.c +++ b/tools/perf/tests/hists_link.c @@ -465,7 +465,7 @@ int test__hists_link(void) goto out; list_for_each_entry(evsel, &evlist->entries, node) { - hists__collapse_resort(&evsel->hists); + hists__collapse_resort(&evsel->hists, NULL); if (verbose > 2) print_hists(&evsel->hists); diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index e935d586d288..8b2d96c56d17 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -395,6 +395,7 @@ static struct hist_entry *add_hist_entry(struct hists *hists, if (!he) return NULL; + hists->nr_entries++; rb_link_node(&he->rb_node_in, parent, p); rb_insert_color(&he->rb_node_in, hists->entries_in); out: @@ -599,7 +600,7 @@ static void hists__apply_filters(struct hists *hists, struct hist_entry *he) hists__filter_entry_by_symbol(hists, he); } -void hists__collapse_resort(struct hists *hists) +void hists__collapse_resort(struct hists *hists, struct perf_progress *prog) { struct rb_root *root; struct rb_node *next; @@ -624,6 +625,8 @@ void hists__collapse_resort(struct hists *hists) */ hists__apply_filters(hists, n); } + if (prog) + ui_progress__advance(prog, 1, "Merging related events..."); } } diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 7f29792efc58..f3d6cf6bd7d4 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h @@ -5,6 +5,7 @@ #include #include "callchain.h" #include "header.h" +#include "ui/progress.h" extern struct callchain_param callchain_param; @@ -104,7 +105,7 @@ struct hist_entry *__hists__add_mem_entry(struct hists *self, u64 weight); void hists__output_resort(struct hists *self); -void hists__collapse_resort(struct hists *self); +void hists__collapse_resort(struct hists *self, struct perf_progress *prog); void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel); void hists__output_recalc_col_len(struct hists *hists, int max_rows); -- 1.7.11.7