Skip to content

Commit d3e184e

Browse files
committed
fix heatmap-preagg.test
Created using spr 1.3.4
2 parents 0d16d90 + de275f7 commit d3e184e

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -450,14 +450,6 @@ int DataAggregator::prepareToParse(StringRef Name, PerfProcessInfo &Process,
450450
Error DataAggregator::preprocessProfile(BinaryContext &BC) {
451451
this->BC = &BC;
452452

453-
if (std::optional<StringRef> FileBuildID = BC.getFileBuildID()) {
454-
outs() << "BOLT-INFO: binary build-id is: " << *FileBuildID << "\n";
455-
processFileBuildID(*FileBuildID);
456-
} else {
457-
errs() << "BOLT-WARNING: build-id will not be checked because we could "
458-
"not read one from input binary\n";
459-
}
460-
461453
auto ErrorCallback = [](int ReturnCode, StringRef ErrBuf) {
462454
errs() << "PERF-ERROR: return code " << ReturnCode << "\n" << ErrBuf;
463455
exit(1);
@@ -476,6 +468,14 @@ Error DataAggregator::preprocessProfile(BinaryContext &BC) {
476468
goto heatmap;
477469
}
478470

471+
if (std::optional<StringRef> FileBuildID = BC.getFileBuildID()) {
472+
outs() << "BOLT-INFO: binary build-id is: " << *FileBuildID << "\n";
473+
processFileBuildID(*FileBuildID);
474+
} else {
475+
errs() << "BOLT-WARNING: build-id will not be checked because we could "
476+
"not read one from input binary\n";
477+
}
478+
479479
if (BC.IsLinuxKernel) {
480480
// Current MMap parsing logic does not work with linux kernel.
481481
// MMap entries for linux kernel uses PERF_RECORD_MMAP
@@ -518,13 +518,12 @@ Error DataAggregator::preprocessProfile(BinaryContext &BC) {
518518
deleteTempFiles();
519519

520520
heatmap:
521-
if (opts::HeatmapMode) {
522-
if (std::error_code EC = printLBRHeatMap())
523-
return errorCodeToError(EC);
524-
exit(0);
525-
}
521+
if (!opts::HeatmapMode)
522+
return Error::success();
526523

527-
return Error::success();
524+
if (std::error_code EC = printLBRHeatMap())
525+
return errorCodeToError(EC);
526+
exit(0);
528527
}
529528

530529
Error DataAggregator::readProfile(BinaryContext &BC) {

bolt/test/X86/heatmap-preagg.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ CHECK-HEATMAP-BAT: HEATMAP: invalid traces: 2
2929
CHECK-SEC-HOT-BAT: Section Name, Begin Address, End Address, Percentage Hotness, Utilization Pct, Partition Score
3030
CHECK-SEC-HOT-BAT-NEXT: .init, 0x401000, 0x40101b, 17.2888, 100.0000, 0.1729
3131
CHECK-SEC-HOT-BAT-NEXT: .plt, 0x401020, 0x4010b0, 5.6132, 66.6667, 0.0374
32-
CHECK-SEC-HOT-BAT-NEXT: .bolt.org.text, 0x4010b0, 0x401c25, 38.3385, 0.1958
32+
CHECK-SEC-HOT-BAT-NEXT: .bolt.org.text, 0x4010b0, 0x401c25, 38.3385, 51.0638, 0.1958
3333
CHECK-SEC-HOT-BAT-NEXT: .fini, 0x401c28, 0x401c35, 0.0000, 0.0000, 0.0000
3434
CHECK-SEC-HOT-BAT-NEXT: .text, 0x800000, 0x8002cc, 38.7595, 91.6667, 0.3553
3535
CHECK-SEC-HOT-BAT-NEXT: .text.cold, 0x800300, 0x800415, 0.0000, 0.0000, 0.0000

0 commit comments

Comments
 (0)