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 <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-3ysn01mpspfrbsy56gznzqqz@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 7b27509f
...@@ -502,6 +502,7 @@ static void flush_sample_queue(struct perf_session *s, ...@@ -502,6 +502,7 @@ static void flush_sample_queue(struct perf_session *s,
struct perf_sample sample; struct perf_sample sample;
u64 limit = os->next_flush; u64 limit = os->next_flush;
u64 last_ts = os->last_sample ? os->last_sample->timestamp : 0ULL; u64 last_ts = os->last_sample ? os->last_sample->timestamp : 0ULL;
unsigned idx = 0, progress_next = os->nr_samples / 16;
int ret; int ret;
if (!ops->ordered_samples || !limit) if (!ops->ordered_samples || !limit)
...@@ -521,6 +522,11 @@ static void flush_sample_queue(struct perf_session *s, ...@@ -521,6 +522,11 @@ static void flush_sample_queue(struct perf_session *s,
os->last_flush = iter->timestamp; os->last_flush = iter->timestamp;
list_del(&iter->list); list_del(&iter->list);
list_add(&iter->list, &os->sample_cache); list_add(&iter->list, &os->sample_cache);
if (++idx >= progress_next) {
progress_next += os->nr_samples / 16;
ui_progress__update(idx, os->nr_samples,
"Processing time ordered events...");
}
} }
if (list_empty(head)) { if (list_empty(head)) {
...@@ -529,6 +535,8 @@ static void flush_sample_queue(struct perf_session *s, ...@@ -529,6 +535,8 @@ static void flush_sample_queue(struct perf_session *s,
os->last_sample = os->last_sample =
list_entry(head->prev, struct sample_queue, list); list_entry(head->prev, struct sample_queue, list);
} }
os->nr_samples = 0;
} }
/* /*
...@@ -588,6 +596,7 @@ static void __queue_event(struct sample_queue *new, struct perf_session *s) ...@@ -588,6 +596,7 @@ static void __queue_event(struct sample_queue *new, struct perf_session *s)
u64 timestamp = new->timestamp; u64 timestamp = new->timestamp;
struct list_head *p; struct list_head *p;
++os->nr_samples;
os->last_sample = new; os->last_sample = new;
if (!sample) { if (!sample) {
......
...@@ -23,6 +23,7 @@ struct ordered_samples { ...@@ -23,6 +23,7 @@ struct ordered_samples {
struct sample_queue *sample_buffer; struct sample_queue *sample_buffer;
struct sample_queue *last_sample; struct sample_queue *last_sample;
int sample_buffer_idx; int sample_buffer_idx;
unsigned int nr_samples;
}; };
struct perf_session { struct perf_session {
......
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