From: Chris Lattner Date: Tue, 20 Aug 2002 18:47:53 +0000 (+0000) Subject: Sort -time-passes report first by user+system, then by Wall clock time. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=b8fa514b1d05ee9fa8632d2f92b3f6ee03bba384;p=oota-llvm.git Sort -time-passes report first by user+system, then by Wall clock time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3407 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp index 24f14f804bf..1c54a1b2d19 100644 --- a/lib/VMCore/Pass.cpp +++ b/lib/VMCore/Pass.cpp @@ -107,6 +107,17 @@ static TimeRecord getTimeRecord() { return Result; } +bool TimeRecord::operator<(const TimeRecord &TR) const { + // Primary sort key is User+System time + if (UserTime+SystemTime < TR.UserTime+TR.SystemTime) + return true; + if (UserTime+SystemTime > TR.UserTime+TR.SystemTime) + return false; + + // Secondary sort key is Wall Time + return Elapsed < TR.Elapsed; +} + void TimeRecord::passStart(const TimeRecord &T) { Elapsed -= T.Elapsed; UserTime -= T.UserTime; diff --git a/lib/VMCore/PassManagerT.h b/lib/VMCore/PassManagerT.h index 83061deac16..9f34f15cca5 100644 --- a/lib/VMCore/PassManagerT.h +++ b/lib/VMCore/PassManagerT.h @@ -85,9 +85,7 @@ struct TimeRecord { // TimeRecord - Data we collect and print for each pass void passStart(const TimeRecord &T); void passEnd(const TimeRecord &T); void sum(const TimeRecord &TR); - bool operator<(const TimeRecord &TR) const { - return UserTime+SystemTime < TR.UserTime+TR.SystemTime; - } + bool operator<(const TimeRecord &TR) const; void print(const char *PassName, const TimeRecord &TotalTime) const; };