diff options
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r-- | tools/perf/builtin-report.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 39367609c707..072ae8ad67fc 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -457,6 +457,19 @@ static void report__collapse_hists(struct report *rep) | |||
457 | ui_progress__finish(); | 457 | ui_progress__finish(); |
458 | } | 458 | } |
459 | 459 | ||
460 | static void report__output_resort(struct report *rep) | ||
461 | { | ||
462 | struct ui_progress prog; | ||
463 | struct perf_evsel *pos; | ||
464 | |||
465 | ui_progress__init(&prog, rep->nr_entries, "Sorting events for output..."); | ||
466 | |||
467 | evlist__for_each(rep->session->evlist, pos) | ||
468 | hists__output_resort(evsel__hists(pos), &prog); | ||
469 | |||
470 | ui_progress__finish(); | ||
471 | } | ||
472 | |||
460 | static int __cmd_report(struct report *rep) | 473 | static int __cmd_report(struct report *rep) |
461 | { | 474 | { |
462 | int ret; | 475 | int ret; |
@@ -505,13 +518,20 @@ static int __cmd_report(struct report *rep) | |||
505 | if (session_done()) | 518 | if (session_done()) |
506 | return 0; | 519 | return 0; |
507 | 520 | ||
521 | /* | ||
522 | * recalculate number of entries after collapsing since it | ||
523 | * might be changed during the collapse phase. | ||
524 | */ | ||
525 | rep->nr_entries = 0; | ||
526 | evlist__for_each(session->evlist, pos) | ||
527 | rep->nr_entries += evsel__hists(pos)->nr_entries; | ||
528 | |||
508 | if (rep->nr_entries == 0) { | 529 | if (rep->nr_entries == 0) { |
509 | ui__error("The %s file has no samples!\n", file->path); | 530 | ui__error("The %s file has no samples!\n", file->path); |
510 | return 0; | 531 | return 0; |
511 | } | 532 | } |
512 | 533 | ||
513 | evlist__for_each(session->evlist, pos) | 534 | report__output_resort(rep); |
514 | hists__output_resort(evsel__hists(pos)); | ||
515 | 535 | ||
516 | return report__browse_hists(rep); | 536 | return report__browse_hists(rep); |
517 | } | 537 | } |