diff options
| author | mingmingl <mingmingl@google.com> | 2025-05-15 09:56:52 -0700 |
|---|---|---|
| committer | mingmingl <mingmingl@google.com> | 2025-05-15 09:56:52 -0700 |
| commit | d15ae3e73589b50edeb2ab823976734eaa3806e5 (patch) | |
| tree | 53f7fa084c3d06a60461fea2125e26ec0b07e771 /llvm/lib/ProfileData/InstrProfReader.cpp | |
| parent | 6dd04e46542851b84bf26cd95245399204072085 (diff) | |
Support reading and writing data access profiles in memprof v4.users/mingmingl-llvm/test
Diffstat (limited to 'llvm/lib/ProfileData/InstrProfReader.cpp')
| -rw-r--r-- | llvm/lib/ProfileData/InstrProfReader.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp index e6c83430cd8e..78aba992fcd6 100644 --- a/llvm/lib/ProfileData/InstrProfReader.cpp +++ b/llvm/lib/ProfileData/InstrProfReader.cpp @@ -1551,6 +1551,20 @@ memprof::AllMemProfData IndexedMemProfReader::getAllMemProfData() const { Pair.Record = std::move(*Record); AllMemProfData.HeapProfileRecords.push_back(std::move(Pair)); } + // Populate the data access profiles for yaml output. + if (DataAccessProfileData != nullptr) { + for (const auto &[SymHandleRef, RecordRef] : + DataAccessProfileData->getRecords()) + AllMemProfData.YamlifiedDataAccessProfiles.Records.push_back( + data_access_prof::DataAccessProfRecord( + SymHandleRef, RecordRef.AccessCount, RecordRef.Locations)); + for (StringRef ColdSymbol : DataAccessProfileData->getKnownColdSymbols()) + AllMemProfData.YamlifiedDataAccessProfiles.KnownColdSymbols.push_back( + ColdSymbol.str()); + for (uint64_t Hash : DataAccessProfileData->getKnownColdHashes()) + AllMemProfData.YamlifiedDataAccessProfiles.KnownColdHashes.push_back( + Hash); + } return AllMemProfData; } |
