Commit 886605636e656afeb6fad5e83dbf36967f65cfa5

Authored by Arnaldo Carvalho de Melo
1 parent 7b27509fc6

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>

Showing 2 changed files with 10 additions and 0 deletions Side-by-side Diff

tools/perf/util/session.c
... ... @@ -502,6 +502,7 @@
502 502 struct perf_sample sample;
503 503 u64 limit = os->next_flush;
504 504 u64 last_ts = os->last_sample ? os->last_sample->timestamp : 0ULL;
  505 + unsigned idx = 0, progress_next = os->nr_samples / 16;
505 506 int ret;
506 507  
507 508 if (!ops->ordered_samples || !limit)
... ... @@ -521,6 +522,11 @@
521 522 os->last_flush = iter->timestamp;
522 523 list_del(&iter->list);
523 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 532 if (list_empty(head)) {
... ... @@ -529,6 +535,8 @@
529 535 os->last_sample =
530 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 @@
588 596 u64 timestamp = new->timestamp;
589 597 struct list_head *p;
590 598  
  599 + ++os->nr_samples;
591 600 os->last_sample = new;
592 601  
593 602 if (!sample) {
tools/perf/util/session.h
... ... @@ -23,6 +23,7 @@
23 23 struct sample_queue *sample_buffer;
24 24 struct sample_queue *last_sample;
25 25 int sample_buffer_idx;
  26 + unsigned int nr_samples;
26 27 };
27 28  
28 29 struct perf_session {