summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 77df516)
raw | patch | inline | side by side (parent: 77df516)
author | Justin Bogner <mail@justinbogner.com> | |
Sun, 23 Mar 2014 20:43:50 +0000 (20:43 +0000) | ||
committer | Justin Bogner <mail@justinbogner.com> | |
Sun, 23 Mar 2014 20:43:50 +0000 (20:43 +0000) |
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204571 91177308-0d34-0410-b5e6-96231b3b80d8
tools/llvm-profdata/llvm-profdata.cpp | patch | blob | history |
index 42783d00ff0cfdab78f75b76efcd09da4b5b12ed..5a0e27fd6d32f6e4dffd16409758dea3ecf4857d 100644 (file)
#include "llvm/ProfileData/InstrProfReader.h"
#include "llvm/ProfileData/InstrProfWriter.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Format.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PrettyStackTrace.h"
return 0;
}
-struct HashPrinter {
- uint64_t Hash;
- HashPrinter(uint64_t Hash) : Hash(Hash) {}
- void print(raw_ostream &OS) const {
- char Buf[18], *Cur = Buf;
- *Cur++ = '0'; *Cur++ = 'x';
- for (unsigned I = 16; I;) {
- char Digit = 0xF & (Hash >> (--I * 4));
- *Cur++ = (Digit < 10 ? '0' + Digit : 'A' + Digit - 10);
- }
- OS.write(Buf, 18);
- }
-};
-static raw_ostream &operator<<(raw_ostream &OS, const HashPrinter &Hash) {
- Hash.print(OS);
- return OS;
-}
-
int show_main(int argc, const char *argv[]) {
cl::opt<std::string> Filename(cl::Positional, cl::Required,
cl::desc("<profdata-file>"));
++ShownFunctions;
OS << " " << Func.Name << ":\n"
- << " Hash: " << HashPrinter(Func.Hash) << "\n"
+ << " Hash: " << format("0x%016" PRIx64, Func.Hash) << "\n"
<< " Counters: " << Func.Counts.size() << "\n"
<< " Function count: " << Func.Counts[0] << "\n";
}