aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-08-20 18:47:53 +0000
committerChris Lattner <sabre@nondot.org>2002-08-20 18:47:53 +0000
commitb8fa514b1d05ee9fa8632d2f92b3f6ee03bba384 (patch)
treecc407105883375944f21f1e0f878ce3db50a84e8 /lib/VMCore
parent05bd1b2eee9742e7b7d69ceaac321bc8f1020295 (diff)
downloadexternal_llvm-b8fa514b1d05ee9fa8632d2f92b3f6ee03bba384.zip
external_llvm-b8fa514b1d05ee9fa8632d2f92b3f6ee03bba384.tar.gz
external_llvm-b8fa514b1d05ee9fa8632d2f92b3f6ee03bba384.tar.bz2
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
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Pass.cpp11
-rw-r--r--lib/VMCore/PassManagerT.h4
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp
index 24f14f8..1c54a1b 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 83061de..9f34f15 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;
};