diff options
author | Kazu Hirata <kazu@google.com> | 2024-12-11 17:58:23 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-11 17:58:23 -0800 |
commit | 9040dd469d61f59235ba5d2ef2c05e661159f877 (patch) | |
tree | 356ac9e61f31ca390cdfcec051240d26afed5083 /llvm/tools/llvm-profdata/llvm-profdata.cpp | |
parent | 9f1e9f682d0a85ea013ccbce6a3ec4ac1be83356 (diff) | |
download | llvm-9040dd469d61f59235ba5d2ef2c05e661159f877.zip llvm-9040dd469d61f59235ba5d2ef2c05e661159f877.tar.gz llvm-9040dd469d61f59235ba5d2ef2c05e661159f877.tar.bz2 |
[memprof] Improve the way we express Frames in YAML (#119629)
This patch does two things:
- During deserialization, we accept a function name for Frame as an
alternative to the usual GUID expressed as a hexadecimal number.
- During serialization, we print a GUID of Frame as a 16-digit
hexadecimal number prefixed with 0x in the usual way. (Without this
patch, we print a decimal number, which is not customary.)
The patch uses a machinery called "normalization" in YAML I/O, which
lets us serialize and deserialize into an alternative data structure.
For our use case, we have an alternative Frame data structure, which
is identical to "struct Frame" except that Function is of type
GUIDHex64 instead of GlobalValue::GUID. This alternative type
supports the two bullet points above without modifying "struct Frame"
at all.
Diffstat (limited to 'llvm/tools/llvm-profdata/llvm-profdata.cpp')
-rw-r--r-- | llvm/tools/llvm-profdata/llvm-profdata.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index 6b9e234..ffc481f 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -3307,7 +3307,9 @@ static int showMemProfProfile(ShowFormat SFormat, raw_fd_ostream &OS) { auto Reader = std::move(ReaderOrErr.get()); memprof::AllMemProfData Data = Reader->getAllMemProfData(); - yaml::Output Yout(OS); + // Construct yaml::Output with the maximum column width of 80 so that each + // Frame fits in one line. + yaml::Output Yout(OS, nullptr, 80); Yout << Data; return 0; |