mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
Fix the -time-passes option to not print NaN when there is zero execution time
llvm-svn: 3382
This commit is contained in:
parent
289ad0e1fd
commit
fe91f23c6d
@ -122,13 +122,20 @@ void TimeRecord::passEnd(const TimeRecord &T) {
|
||||
MaxRSS = std::max(MaxRSS, RSSTemp);
|
||||
}
|
||||
|
||||
static void printVal(double Val, double Total) {
|
||||
if (Total < 1e-7) // Avoid dividing by zero...
|
||||
fprintf(stderr, " ----- ");
|
||||
else
|
||||
fprintf(stderr, " %7.4f (%5.1f%%)", Val, Val*100/Total);
|
||||
}
|
||||
|
||||
void TimeRecord::print(const char *PassName, const TimeRecord &Total) const {
|
||||
fprintf(stderr,
|
||||
" %7.4f (%5.1f%%) %7.4f (%5.1f%%) %7.4f (%5.1f%%) %7.4f (%5.1f%%) ",
|
||||
UserTime , UserTime *100/Total.UserTime,
|
||||
SystemTime, SystemTime*100/Total.SystemTime,
|
||||
UserTime+SystemTime, (UserTime+SystemTime)*100/(Total.UserTime+Total.SystemTime),
|
||||
Elapsed , Elapsed *100/Total.Elapsed);
|
||||
printVal(UserTime, Total.UserTime);
|
||||
printVal(SystemTime, Total.SystemTime);
|
||||
printVal(UserTime+SystemTime, Total.UserTime+Total.SystemTime);
|
||||
printVal(Elapsed, Total.Elapsed);
|
||||
|
||||
fprintf(stderr, " ");
|
||||
|
||||
if (Total.MaxRSS)
|
||||
std::cerr << MaxRSS << "\t";
|
||||
|
Loading…
Reference in New Issue
Block a user