Sort -time-passes report first by user+system, then by Wall clock time.

llvm-svn: 3407
This commit is contained in:
Chris Lattner 2002-08-20 18:47:53 +00:00
parent b8d6e40ed7
commit e821d78432
2 changed files with 12 additions and 3 deletions

View 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;

View 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;
};