Skip to content

Commit f976ad6

Browse files
Bill Nellmemfrob
authored andcommitted
[BOLT] Add value profiling to BOLT
Summary: Add support for reading value profiling info from perf data. This diff adds support in DataReader/DataAggregator for value profiling data. Each event is recorded as two Locations (a PC and an address/value) and a count. For now, I'm assuming that the value profiling data is in the same file as the usual BOLT profiling data. Collecting both at the same time seems to work. (cherry picked from FBD6076877)
1 parent c0628ae commit f976ad6

File tree

6 files changed

+699
-104
lines changed

6 files changed

+699
-104
lines changed

bolt/BinaryContext.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,16 @@ void BinaryContext::printInstruction(raw_ostream &OS,
369369
}
370370
}
371371

372+
auto *MD = Function ? DR.getFuncMemData(Function->getNames()) : nullptr;
373+
if (MD) {
374+
bool DidPrint = false;
375+
for (auto &MI : MD->getMemInfoRange(Offset)) {
376+
OS << (DidPrint ? ", " : " # Loads: ");
377+
OS << MI.Addr << "/" << MI.Count;
378+
DidPrint = true;
379+
}
380+
}
381+
372382
OS << "\n";
373383

374384
if (printMCInst) {

0 commit comments

Comments
 (0)