@@ -466,9 +466,7 @@ int DataAggregator::prepareToParse(StringRef Name, PerfProcessInfo &Process,
466
466
return PI.ReturnCode ;
467
467
}
468
468
469
- Error DataAggregator::preprocessProfile (BinaryContext &BC) {
470
- this ->BC = &BC;
471
-
469
+ void DataAggregator::parsePerfData (BinaryContext &BC) {
472
470
auto ErrorCallback = [](int ReturnCode, StringRef ErrBuf) {
473
471
errs () << " PERF-ERROR: return code " << ReturnCode << " \n " << ErrBuf;
474
472
exit (1 );
@@ -481,11 +479,6 @@ Error DataAggregator::preprocessProfile(BinaryContext &BC) {
481
479
ErrorCallback (ReturnCode, ErrBuf);
482
480
};
483
481
484
- if (opts::ReadPreAggregated) {
485
- parsePreAggregated ();
486
- goto heatmap;
487
- }
488
-
489
482
if (std::optional<StringRef> FileBuildID = BC.getFileBuildID ()) {
490
483
outs () << " BOLT-INFO: binary build-id is: " << *FileBuildID << " \n " ;
491
484
processFileBuildID (*FileBuildID);
@@ -534,22 +527,28 @@ Error DataAggregator::preprocessProfile(BinaryContext &BC) {
534
527
<< ' \n ' ;
535
528
536
529
deleteTempFiles ();
530
+ }
537
531
538
- heatmap:
539
- // Sort parsed traces for faster processing.
540
- llvm::sort (Traces, llvm::less_first ());
532
+ Error DataAggregator::preprocessProfile (BinaryContext &BC) {
533
+ this ->BC = &BC;
541
534
542
- if (!opts::HeatmapMode)
543
- return Error::success ();
535
+ if (opts::ReadPreAggregated) {
536
+ parsePreAggregated ();
537
+ } else {
538
+ parsePerfData (BC);
539
+ }
544
540
545
- if (std::error_code EC = printLBRHeatMap ())
546
- return errorCodeToError (EC );
541
+ // Sort parsed traces for faster processing.
542
+ llvm::sort (Traces, llvm::less_first () );
547
543
548
- if (opts::HeatmapMode == opts::HeatmapModeKind::HM_Optional)
549
- return Error::success ();
544
+ if (opts::HeatmapMode) {
545
+ if (std::error_code EC = printLBRHeatMap ())
546
+ return errorCodeToError (EC);
547
+ if (opts::HeatmapMode == opts::HeatmapModeKind::HM_Exclusive)
548
+ exit (0 );
549
+ }
550
550
551
- assert (opts::HeatmapMode == opts::HeatmapModeKind::HM_Exclusive);
552
- exit (0 );
551
+ return Error::success ();
553
552
}
554
553
555
554
Error DataAggregator::readProfile (BinaryContext &BC) {
0 commit comments