Commit d9aedc12 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf annotate: Show progress of sample processing

Like 'perf report', it can take a while to process samples.

Show a progress window to inform users how that it is not stuck.
Reviewed-by: default avatarIan Rogers <irogers@google.com>
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240411033256.2099646-3-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent eb833488
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "util/map_symbol.h" #include "util/map_symbol.h"
#include "util/branch.h" #include "util/branch.h"
#include "util/util.h" #include "util/util.h"
#include "ui/progress.h"
#include <dlfcn.h> #include <dlfcn.h>
#include <errno.h> #include <errno.h>
...@@ -665,13 +666,23 @@ static int __cmd_annotate(struct perf_annotate *ann) ...@@ -665,13 +666,23 @@ static int __cmd_annotate(struct perf_annotate *ann)
evlist__for_each_entry(session->evlist, pos) { evlist__for_each_entry(session->evlist, pos) {
struct hists *hists = evsel__hists(pos); struct hists *hists = evsel__hists(pos);
u32 nr_samples = hists->stats.nr_samples; u32 nr_samples = hists->stats.nr_samples;
struct ui_progress prog;
if (nr_samples > 0) { if (nr_samples > 0) {
total_nr_samples += nr_samples; total_nr_samples += nr_samples;
hists__collapse_resort(hists, NULL);
ui_progress__init(&prog, nr_samples,
"Merging related events...");
hists__collapse_resort(hists, &prog);
ui_progress__finish();
/* Don't sort callchain */ /* Don't sort callchain */
evsel__reset_sample_bit(pos, CALLCHAIN); evsel__reset_sample_bit(pos, CALLCHAIN);
evsel__output_resort(pos, NULL);
ui_progress__init(&prog, nr_samples,
"Sorting events for output...");
evsel__output_resort(pos, &prog);
ui_progress__finish();
/* /*
* An event group needs to display other events too. * An event group needs to display other events too.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment