Skip to content

Commit 8866056

Browse files
committed
perf report: Add progress bar when processing time ordered events
So that for large perf.data files the user can have visual feedback that activity is being performed. 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]>
1 parent 7b27509 commit 8866056

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

tools/perf/util/session.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ static void flush_sample_queue(struct perf_session *s,
502502
struct perf_sample sample;
503503
u64 limit = os->next_flush;
504504
u64 last_ts = os->last_sample ? os->last_sample->timestamp : 0ULL;
505+
unsigned idx = 0, progress_next = os->nr_samples / 16;
505506
int ret;
506507

507508
if (!ops->ordered_samples || !limit)
@@ -521,6 +522,11 @@ static void flush_sample_queue(struct perf_session *s,
521522
os->last_flush = iter->timestamp;
522523
list_del(&iter->list);
523524
list_add(&iter->list, &os->sample_cache);
525+
if (++idx >= progress_next) {
526+
progress_next += os->nr_samples / 16;
527+
ui_progress__update(idx, os->nr_samples,
528+
"Processing time ordered events...");
529+
}
524530
}
525531

526532
if (list_empty(head)) {
@@ -529,6 +535,8 @@ static void flush_sample_queue(struct perf_session *s,
529535
os->last_sample =
530536
list_entry(head->prev, struct sample_queue, list);
531537
}
538+
539+
os->nr_samples = 0;
532540
}
533541

534542
/*
@@ -588,6 +596,7 @@ static void __queue_event(struct sample_queue *new, struct perf_session *s)
588596
u64 timestamp = new->timestamp;
589597
struct list_head *p;
590598

599+
++os->nr_samples;
591600
os->last_sample = new;
592601

593602
if (!sample) {

tools/perf/util/session.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ struct ordered_samples {
2323
struct sample_queue *sample_buffer;
2424
struct sample_queue *last_sample;
2525
int sample_buffer_idx;
26+
unsigned int nr_samples;
2627
};
2728

2829
struct perf_session {

0 commit comments

Comments
 (0)