Print out the profile summary in YAML format to make it easier to for
tools and tests to read in the contents of the raw profile.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
PTAL, thanks!
I would really like to have a test to ensure that the YAML we generate is valid but it seems hard to implement without defining a document type to parse into as a unittest (see https://llvm.org/docs/YamlIO.html#input). Alternatively, I could also extend the lit based test to check if YAML is available like this usage in MLIR (https://git.io/J9ORA). Any suggestions?
llvm/lib/ProfileData/RawMemProfReader.cpp | ||
---|---|---|
101 | Documented the format in the header. | |
llvm/tools/llvm-profdata/llvm-profdata.cpp | ||
2484 | Added a new printYAML method and moved the `OS << "memprof_profile:" statement there. |
I don't have a strong feeling. Looks like the tests that dump opt remarks to yaml format just manually check that the output lines look as expected but don't attempt to parse them via yaml itself.
llvm/tools/llvm-profdata/llvm-profdata.cpp | ||
---|---|---|
2484 | Is there a reason for not wanting to put it at the top of printSummaries? |
Convert the snake case yaml to camel case with initcap (matching llvm variable naming convention). This makes it easy to use macro based expansion to generate the meminfoblock contents in subsequent patches.
Ok, let me punt on this for now.
I've changed the YAML naming from snake case to match the LLVM variable naming style to keep it consistent with the output from the macro based implementation in D117256.
PTAL, thanks!
llvm/tools/llvm-profdata/llvm-profdata.cpp | ||
---|---|---|
2484 | Yes, the MemprofProfile marks the outermost object which holds the rest of the information incl. the header information (from printSummaries) and the contents of the raw profile (functionality added in D116784). I decided to introduce the printYAML method in this patch rather than have the print inside printSummaries and then pull it out into a separate method in the next one where we print out the contents of the profile. LMK if you feel strongly about keeping it in the printSummaries method. |
Add a comment here and/or at the declaration that this is printing in YAML format.