Skip to content

Commit 616489e

Browse files
authored
[BOLT] Drop perf2bolt cold samples diagnostic (#139337)
Cold samples diagnostics in perf2bolt are superseded by `perf2bolt --heatmap` option (#139194). It provides a superset of stats and works without BAT section which is not emitted by default. Test Plan: NFC
1 parent 0289ca0 commit 616489e

File tree

2 files changed

+3
-32
lines changed

2 files changed

+3
-32
lines changed

bolt/include/bolt/Profile/DataAggregator.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,6 @@ class DataAggregator : public DataReader {
212212
uint64_t NumTraces{0};
213213
uint64_t NumInvalidTraces{0};
214214
uint64_t NumLongRangeTraces{0};
215-
/// Specifies how many samples were recorded in cold areas if we are dealing
216-
/// with profiling data collected in a bolted binary. For LBRs, incremented
217-
/// for the source of the branch to avoid counting cold activity twice (one
218-
/// for source and another for destination).
219-
uint64_t NumColdSamples{0};
220215
uint64_t NumTotalSamples{0};
221216

222217
/// Looks into system PATH for Linux Perf and set up the aggregator to use it
@@ -473,7 +468,6 @@ class DataAggregator : public DataReader {
473468
void dump(const PerfMemSample &Sample) const;
474469

475470
/// Profile diagnostics print methods
476-
void printColdSamplesDiagnostic() const;
477471
void printLongRangeTracesDiagnostic() const;
478472
void printBranchSamplesDiagnostics() const;
479473
void printBasicSamplesDiagnostics(uint64_t OutOfRangeSamples) const;

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,6 @@ bool DataAggregator::doBasicSample(BinaryFunction &OrigFunc, uint64_t Address,
640640

641641
BinaryFunction *ParentFunc = getBATParentFunction(OrigFunc);
642642
BinaryFunction &Func = ParentFunc ? *ParentFunc : OrigFunc;
643-
if (ParentFunc || (BAT && !BAT->isBATFunction(Func.getAddress())))
644-
NumColdSamples += Count;
645643
// Attach executed bytes to parent function in case of cold fragment.
646644
Func.SampleCountInBytes += Count * BlockSize;
647645

@@ -745,15 +743,10 @@ bool DataAggregator::doBranch(uint64_t From, uint64_t To, uint64_t Count,
745743
if (BAT)
746744
Addr = BAT->translate(Func->getAddress(), Addr, IsFrom);
747745

748-
BinaryFunction *ParentFunc = getBATParentFunction(*Func);
749-
if (IsFrom &&
750-
(ParentFunc || (BAT && !BAT->isBATFunction(Func->getAddress()))))
751-
NumColdSamples += Count;
746+
if (BinaryFunction *ParentFunc = getBATParentFunction(*Func))
747+
Func = ParentFunc;
752748

753-
if (!ParentFunc)
754-
return std::pair{Func, IsRet};
755-
756-
return std::pair{ParentFunc, IsRet};
749+
return std::pair{Func, IsRet};
757750
};
758751

759752
auto [FromFunc, IsReturn] = handleAddress(From, /*IsFrom*/ true);
@@ -1450,20 +1443,6 @@ void DataAggregator::parseLBRSample(const PerfBranchSample &Sample,
14501443
}
14511444
}
14521445

1453-
void DataAggregator::printColdSamplesDiagnostic() const {
1454-
if (NumColdSamples > 0) {
1455-
const float ColdSamples = NumColdSamples * 100.0f / NumTotalSamples;
1456-
outs() << "PERF2BOLT: " << NumColdSamples
1457-
<< format(" (%.1f%%)", ColdSamples)
1458-
<< " samples recorded in cold regions of split functions.\n";
1459-
if (ColdSamples > 5.0f)
1460-
outs()
1461-
<< "WARNING: The BOLT-processed binary where samples were collected "
1462-
"likely used bad data or your service observed a large shift in "
1463-
"profile. You may want to audit this\n";
1464-
}
1465-
}
1466-
14671446
void DataAggregator::printLongRangeTracesDiagnostic() const {
14681447
outs() << "PERF2BOLT: out of range traces involving unknown regions: "
14691448
<< NumLongRangeTraces;
@@ -1504,7 +1483,6 @@ void DataAggregator::printBranchSamplesDiagnostics() const {
15041483
"collection. The generated data may be ineffective for improving "
15051484
"performance\n\n";
15061485
printLongRangeTracesDiagnostic();
1507-
printColdSamplesDiagnostic();
15081486
}
15091487

15101488
void DataAggregator::printBasicSamplesDiagnostics(
@@ -1516,7 +1494,6 @@ void DataAggregator::printBasicSamplesDiagnostics(
15161494
"binary is probably not the same binary used during profiling "
15171495
"collection. The generated data may be ineffective for improving "
15181496
"performance\n\n";
1519-
printColdSamplesDiagnostic();
15201497
}
15211498

15221499
void DataAggregator::printBranchStacksDiagnostics(

0 commit comments

Comments
 (0)