diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-29 10:41:45 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-11-02 10:28:35 -0400 |
commit | 886605636e656afeb6fad5e83dbf36967f65cfa5 (patch) | |
tree | 410b8bf4a9d98afd2b7f4901b053a94692f1a1ec /tools/perf | |
parent | 7b27509fc62686c53e9301560034e6b0b001174d (diff) |
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.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/session.c | 9 | ||||
-rw-r--r-- | tools/perf/util/session.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index da354fe5e085..85c1e6b76f0a 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -502,6 +502,7 @@ static void flush_sample_queue(struct perf_session *s, | |||
502 | struct perf_sample sample; | 502 | struct perf_sample sample; |
503 | u64 limit = os->next_flush; | 503 | u64 limit = os->next_flush; |
504 | u64 last_ts = os->last_sample ? os->last_sample->timestamp : 0ULL; | 504 | u64 last_ts = os->last_sample ? os->last_sample->timestamp : 0ULL; |
505 | unsigned idx = 0, progress_next = os->nr_samples / 16; | ||
505 | int ret; | 506 | int ret; |
506 | 507 | ||
507 | if (!ops->ordered_samples || !limit) | 508 | if (!ops->ordered_samples || !limit) |
@@ -521,6 +522,11 @@ static void flush_sample_queue(struct perf_session *s, | |||
521 | os->last_flush = iter->timestamp; | 522 | os->last_flush = iter->timestamp; |
522 | list_del(&iter->list); | 523 | list_del(&iter->list); |
523 | list_add(&iter->list, &os->sample_cache); | 524 | 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 | } | ||
524 | } | 530 | } |
525 | 531 | ||
526 | if (list_empty(head)) { | 532 | if (list_empty(head)) { |
@@ -529,6 +535,8 @@ static void flush_sample_queue(struct perf_session *s, | |||
529 | os->last_sample = | 535 | os->last_sample = |
530 | list_entry(head->prev, struct sample_queue, list); | 536 | list_entry(head->prev, struct sample_queue, list); |
531 | } | 537 | } |
538 | |||
539 | os->nr_samples = 0; | ||
532 | } | 540 | } |
533 | 541 | ||
534 | /* | 542 | /* |
@@ -588,6 +596,7 @@ static void __queue_event(struct sample_queue *new, struct perf_session *s) | |||
588 | u64 timestamp = new->timestamp; | 596 | u64 timestamp = new->timestamp; |
589 | struct list_head *p; | 597 | struct list_head *p; |
590 | 598 | ||
599 | ++os->nr_samples; | ||
591 | os->last_sample = new; | 600 | os->last_sample = new; |
592 | 601 | ||
593 | if (!sample) { | 602 | if (!sample) { |
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h index 514b06d41f05..6e393c98eb34 100644 --- a/tools/perf/util/session.h +++ b/tools/perf/util/session.h | |||
@@ -23,6 +23,7 @@ struct ordered_samples { | |||
23 | struct sample_queue *sample_buffer; | 23 | struct sample_queue *sample_buffer; |
24 | struct sample_queue *last_sample; | 24 | struct sample_queue *last_sample; |
25 | int sample_buffer_idx; | 25 | int sample_buffer_idx; |
26 | unsigned int nr_samples; | ||
26 | }; | 27 | }; |
27 | 28 | ||
28 | struct perf_session { | 29 | struct perf_session { |