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
This commit is contained in:
Benjamin Kramer
2011-10-16 16:30:34 +00:00
parent 47b8798c0b
commit 962bad70f4
5 changed files with 24 additions and 30 deletions
+6 -10
View File
@@ -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())