aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/Timer.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-10-16 16:30:34 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-10-16 16:30:34 +0000
commit962bad70f4277841cf6278306caa93ebce304b48 (patch)
treef8e798ee4db25f43337848f01fcc09b276b9d3e1 /lib/Support/Timer.cpp
parent47b8798c0bf0944b24051bc21d85d93a2732676a (diff)
Let printf do the formatting instead aligning strings ourselves.
While at it, merge some format strings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142140 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Timer.cpp')
-rw-r--r--lib/Support/Timer.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/Support/Timer.cpp b/lib/Support/Timer.cpp
index a9ed5eecfa..03ac9632f0 100644
--- a/lib/Support/Timer.cpp
+++ b/lib/Support/Timer.cpp
@@ -168,10 +168,8 @@ void Timer::stopTimer() {
static void printVal(double Val, double Total, raw_ostream &OS) {
if (Total < 1e-7) // Avoid dividing by zero.
OS << " ----- ";
- else {
- OS << " " << format("%7.4f", Val) << " (";
- OS << format("%5.1f", Val*100/Total) << "%)";
- }
+ else
+ OS << format(" %7.4f (%5.1f%%)", Val, Val*100/Total);
}
void TimeRecord::print(const TimeRecord &Total, raw_ostream &OS) const {
@@ -186,7 +184,7 @@ void TimeRecord::print(const TimeRecord &Total, raw_ostream &OS) const {
OS << " ";
if (Total.getMemUsed())
- OS << format("%9lld", (long long)getMemUsed()) << " ";
+ OS << format("%9lld ", (long long)getMemUsed());
}
@@ -332,11 +330,9 @@ void TimerGroup::PrintQueuedTimers(raw_ostream &OS) {
// If this is not an collection of ungrouped times, print the total time.
// Ungrouped timers don't really make sense to add up. We still print the
// TOTAL line to make the percentages make sense.
- if (this != DefaultTimerGroup) {
- OS << " Total Execution Time: ";
- OS << format("%5.4f", Total.getProcessTime()) << " seconds (";
- OS << format("%5.4f", Total.getWallTime()) << " wall clock)\n";
- }
+ if (this != DefaultTimerGroup)
+ OS << format(" Total Execution Time: %5.4f seconds (%5.4f wall clock)\n",
+ Total.getProcessTime(), Total.getWallTime());
OS << '\n';
if (Total.getUserTime())