Sort -time-passes report first by user+system, then by Wall clock time.
authorChris Lattner <sabre@nondot.org>
Tue, 20 Aug 2002 18:47:53 +0000 (18:47 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 20 Aug 2002 18:47:53 +0000 (18:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3407 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Pass.cpp
lib/VMCore/PassManagerT.h

index 24f14f804bf23b767deaebb69d0ca51f99a5fe79..1c54a1b2d19ec7f2f3dc1b5fc78ae4a381cf4568 100644 (file)
@@ -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;
index 83061deac16a2cc306b6153bfef3b06ea68760cd..9f34f15cca5911c2024e209d48eacaf2ac11b120 100644 (file)
@@ -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;
 };