diff options
| author | Xinliang David Li <davidxl@google.com> | 2015-11-23 20:47:38 +0000 |
|---|---|---|
| committer | Xinliang David Li <davidxl@google.com> | 2015-11-23 20:47:38 +0000 |
| commit | 6f7c19a494fdf8aecf5053e4201f222eb1fa4bed (patch) | |
| tree | 16f3ea4432e185a9285b43d8ddae679b11c079f5 /llvm/lib/ProfileData | |
| parent | 243ea6a7d6d90eb52d3e30cb4a2b73d3fd428f88 (diff) | |
| download | bcm5719-llvm-6f7c19a494fdf8aecf5053e4201f222eb1fa4bed.tar.gz bcm5719-llvm-6f7c19a494fdf8aecf5053e4201f222eb1fa4bed.zip | |
[PGO] Add --text option for llvm-profdata show|merge commands
The new option is similar to the SampleProfile dump option.
- dump raw/indexed format into text profile format
- merge the profile and output into text profile format.
Note that Value Profiling data text format is not yet designed.
That functionality will be added later.
Differential Revision: http://reviews.llvm.org/D14894
llvm-svn: 253913
Diffstat (limited to 'llvm/lib/ProfileData')
| -rw-r--r-- | llvm/lib/ProfileData/InstrProfWriter.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp index 9c4d311f475..1c97b1ad0d3 100644 --- a/llvm/lib/ProfileData/InstrProfWriter.cpp +++ b/llvm/lib/ProfileData/InstrProfWriter.cpp @@ -171,6 +171,21 @@ void InstrProfWriter::write(raw_fd_ostream &OS) { endian::Writer<little>(OS).write<uint64_t>(TableStart.second); } +void InstrProfWriter::writeRecordInText(const InstrProfRecord &Func, + raw_fd_ostream &OS) { + OS << Func.Name << "\n" << Func.Hash << "\n" << Func.Counts.size() << "\n"; + for (uint64_t Count : Func.Counts) + OS << Count << "\n"; + + OS << "\n"; +} + +void InstrProfWriter::writeText(raw_fd_ostream &OS) { + for (const auto &I : FunctionData) + for (const auto &Func : I.getValue()) + writeRecordInText(Func.second, OS); +} + std::unique_ptr<MemoryBuffer> InstrProfWriter::writeBuffer() { std::string Data; llvm::raw_string_ostream OS(Data); |

