aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-bcanalyzer
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-09-25 16:04:21 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-09-25 16:04:21 +0000
commit42985bbe385264550cd01acfdb412abf0de316d3 (patch)
treed99f09decae752e5e1532190ad4145dfff2d3be6 /tools/llvm-bcanalyzer
parent80ba3d2c0ba873e902f29bf3aae7fbc06dfe9ca5 (diff)
Make llvm-bcanalyzer percentages more readable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82772 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-bcanalyzer')
-rw-r--r--tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
index 01c6329520..6d5b2b51a8 100644
--- a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
+++ b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
@@ -32,6 +32,7 @@
#include "llvm/Bitcode/LLVMBitCodes.h"
#include "llvm/Bitcode/ReaderWriter.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"
@@ -546,8 +547,8 @@ static int AnalyzeBitcode() {
errs() << " Total Size: ";
PrintSize(Stats.NumBits);
errs() << "\n";
- errs() << " % of file: "
- << Stats.NumBits/(double)BufferSizeBits*100 << "\n";
+ double pct = (Stats.NumBits * 100.0) / BufferSizeBits;
+ errs() << " Percent of file: " << format("%2.4f%%", pct) << "\n";
if (Stats.NumInstances > 1) {
errs() << " Average Size: ";
PrintSize(Stats.NumBits/(double)Stats.NumInstances);
@@ -563,9 +564,10 @@ static int AnalyzeBitcode() {
errs() << " Num Abbrevs: " << Stats.NumAbbrevs << "\n";
errs() << " Num Records: " << Stats.NumRecords << "\n";
}
- if (Stats.NumRecords)
- errs() << " % Abbrev Recs: " << (Stats.NumAbbreviatedRecords/
- (double)Stats.NumRecords)*100 << "\n";
+ if (Stats.NumRecords) {
+ double pct = (Stats.NumAbbreviatedRecords * 100.0) / Stats.NumRecords;
+ errs() << " Percent Abbrevs: " << format("%2.4f%%", pct) << "\n";
+ }
errs() << "\n";
// Print a histogram of the codes we see.