X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSupport%2FTimer.cpp;h=896d869aa1e7ed6a9c3fcf8597f79eb29af76a28;hb=fe532525cc4912ec0d1b4e91fa0396122dd087b3;hp=bf4595484981e9dcaa92337fd5ac5ca31218e35f;hpb=933b16e665fba5b29fd83e762390f23c2eaf77db;p=oota-llvm.git diff --git a/lib/Support/Timer.cpp b/lib/Support/Timer.cpp index bf459548498..896d869aa1e 100644 --- a/lib/Support/Timer.cpp +++ b/lib/Support/Timer.cpp @@ -12,16 +12,15 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/Timer.h" +#include "llvm/ADT/OwningPtr.h" +#include "llvm/ADT/StringMap.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/Format.h" #include "llvm/Support/ManagedStatic.h" +#include "llvm/Support/Mutex.h" +#include "llvm/Support/Process.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/Support/Format.h" -#include "llvm/System/Mutex.h" -#include "llvm/System/Process.h" -#include "llvm/ADT/OwningPtr.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/StringMap.h" using namespace llvm; // CreateInfoOutputFile - Return a file stream to print our output on. @@ -169,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 { @@ -187,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("%9" PRId64 " ", (int64_t)getMemUsed()); } @@ -316,8 +313,8 @@ void TimerGroup::addTimer(Timer &T) { void TimerGroup::PrintQueuedTimers(raw_ostream &OS) { // Sort the timers in descending order by amount of time taken. - array_pod_sort(TimersToPrint.begin(), TimersToPrint.end()); - + std::sort(TimersToPrint.begin(), TimersToPrint.end()); + TimeRecord Total; for (unsigned i = 0, e = TimersToPrint.size(); i != e; ++i) Total += TimersToPrint[i].first; @@ -333,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())