aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-report.c73
1 files changed, 45 insertions, 28 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 03941ad8fc46..cff9465847f2 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -486,13 +486,55 @@ static int report__browse_hists(struct report *rep)
486 return ret; 486 return ret;
487} 487}
488 488
489static u64 report__collapse_hists(struct report *rep)
490{
491 struct ui_progress prog;
492 struct perf_evsel *pos;
493 u64 nr_samples = 0;
494 /*
495 * Count number of histogram entries to use when showing progress,
496 * reusing nr_samples variable.
497 */
498 list_for_each_entry(pos, &rep->session->evlist->entries, node)
499 nr_samples += pos->hists.nr_entries;
500
501 ui_progress__init(&prog, nr_samples, "Merging related events...");
502 /*
503 * Count total number of samples, will be used to check if this
504 * session had any.
505 */
506 nr_samples = 0;
507
508 list_for_each_entry(pos, &rep->session->evlist->entries, node) {
509 struct hists *hists = &pos->hists;
510
511 if (pos->idx == 0)
512 hists->symbol_filter_str = rep->symbol_filter_str;
513
514 hists__collapse_resort(hists, &prog);
515 nr_samples += hists->stats.nr_events[PERF_RECORD_SAMPLE];
516
517 /* Non-group events are considered as leader */
518 if (symbol_conf.event_group &&
519 !perf_evsel__is_group_leader(pos)) {
520 struct hists *leader_hists = &pos->leader->hists;
521
522 hists__match(leader_hists, hists);
523 hists__link(leader_hists, hists);
524 }
525 }
526
527 ui_progress__finish();
528
529 return nr_samples;
530}
531
489static int __cmd_report(struct report *rep) 532static int __cmd_report(struct report *rep)
490{ 533{
491 int ret = -EINVAL; 534 int ret;
492 u64 nr_samples; 535 u64 nr_samples;
493 struct perf_session *session = rep->session; 536 struct perf_session *session = rep->session;
494 struct perf_evsel *pos; 537 struct perf_evsel *pos;
495 struct ui_progress prog;
496 struct perf_data_file *file = session->file; 538 struct perf_data_file *file = session->file;
497 539
498 signal(SIGINT, sig_handler); 540 signal(SIGINT, sig_handler);
@@ -530,32 +572,7 @@ static int __cmd_report(struct report *rep)
530 } 572 }
531 } 573 }
532 574
533 nr_samples = 0; 575 nr_samples = report__collapse_hists(rep);
534 list_for_each_entry(pos, &session->evlist->entries, node)
535 nr_samples += pos->hists.nr_entries;
536
537 ui_progress__init(&prog, nr_samples, "Merging related events...");
538
539 nr_samples = 0;
540 list_for_each_entry(pos, &session->evlist->entries, node) {
541 struct hists *hists = &pos->hists;
542
543 if (pos->idx == 0)
544 hists->symbol_filter_str = rep->symbol_filter_str;
545
546 hists__collapse_resort(hists, &prog);
547 nr_samples += hists->stats.nr_events[PERF_RECORD_SAMPLE];
548
549 /* Non-group events are considered as leader */
550 if (symbol_conf.event_group &&
551 !perf_evsel__is_group_leader(pos)) {
552 struct hists *leader_hists = &pos->leader->hists;
553
554 hists__match(leader_hists, hists);
555 hists__link(leader_hists, hists);
556 }
557 }
558 ui_progress__finish();
559 576
560 if (session_done()) 577 if (session_done())
561 return 0; 578 return 0;