diff options
author | Kazu Hirata <kazu@google.com> | 2024-04-03 21:48:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-03 21:48:38 -0700 |
commit | d89914f30bc7c180fe349a5aa0f03438ae6c20a4 (patch) | |
tree | bd2319e84ed6e6cd439d6f97c12c137d96179ce5 /llvm/lib/ProfileData/InstrProfReader.cpp | |
parent | 3a7b5223a6639e497c856368da11b5d74ec9d6e8 (diff) | |
download | llvm-d89914f30bc7c180fe349a5aa0f03438ae6c20a4.zip llvm-d89914f30bc7c180fe349a5aa0f03438ae6c20a4.tar.gz llvm-d89914f30bc7c180fe349a5aa0f03438ae6c20a4.tar.bz2 |
[memprof] Add Version2 of IndexedMemProfRecord serialization (#87455)
I'm currently developing a new version of the indexed memprof format
where we deduplicate call stacks in IndexedAllocationInfo::CallStack
and IndexedMemProfRecord::CallSites. We refer to call stacks with
integer IDs, namely CallStackId, just as we refer to Frame with
FrameId. The deduplication will cut down the profile file size by 80%
in a large memprof file of mine.
As a step toward the goal, this patch teaches
IndexedMemProfRecord::{serialize,deserialize} to speak Version2. A
subsequent patch will add Version2 support to llvm-profdata.
The essense of the patch is to replace the serialization of a call
stack, a vector of FrameIDs, with that of a CallStackId. That is:
const IndexedAllocationInfo &N = ...;
...
LE.write<uint64_t>(N.CallStack.size());
for (const FrameId &Id : N.CallStack)
LE.write<FrameId>(Id);
becomes:
LE.write<CallStackId>(N.CSId);
Diffstat (limited to 'llvm/lib/ProfileData/InstrProfReader.cpp')
-rw-r--r-- | llvm/lib/ProfileData/InstrProfReader.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp index 7ac5c56..884334e 100644 --- a/llvm/lib/ProfileData/InstrProfReader.cpp +++ b/llvm/lib/ProfileData/InstrProfReader.cpp @@ -1303,7 +1303,7 @@ Error IndexedInstrProfReader::readHeader() { MemProfRecordTable.reset(MemProfRecordHashTable::Create( /*Buckets=*/Start + RecordTableOffset, /*Payload=*/Ptr, - /*Base=*/Start, memprof::RecordLookupTrait(Schema))); + /*Base=*/Start, memprof::RecordLookupTrait(memprof::Version1, Schema))); // Initialize the frame table reader with the payload and bucket offsets. MemProfFrameTable.reset(MemProfFrameHashTable::Create( |