mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-18 12:29:27 +00:00
Fix the -time-passes option to not print NaN when there is zero execution time
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3382 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0bfb6ba3e3
commit
f5526b6edb
@ -122,13 +122,20 @@ void TimeRecord::passEnd(const TimeRecord &T) {
|
|||||||
MaxRSS = std::max(MaxRSS, RSSTemp);
|
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 {
|
void TimeRecord::print(const char *PassName, const TimeRecord &Total) const {
|
||||||
fprintf(stderr,
|
printVal(UserTime, Total.UserTime);
|
||||||
" %7.4f (%5.1f%%) %7.4f (%5.1f%%) %7.4f (%5.1f%%) %7.4f (%5.1f%%) ",
|
printVal(SystemTime, Total.SystemTime);
|
||||||
UserTime , UserTime *100/Total.UserTime,
|
printVal(UserTime+SystemTime, Total.UserTime+Total.SystemTime);
|
||||||
SystemTime, SystemTime*100/Total.SystemTime,
|
printVal(Elapsed, Total.Elapsed);
|
||||||
UserTime+SystemTime, (UserTime+SystemTime)*100/(Total.UserTime+Total.SystemTime),
|
|
||||||
Elapsed , Elapsed *100/Total.Elapsed);
|
fprintf(stderr, " ");
|
||||||
|
|
||||||
if (Total.MaxRSS)
|
if (Total.MaxRSS)
|
||||||
std::cerr << MaxRSS << "\t";
|
std::cerr << MaxRSS << "\t";
|
||||||
|
Loading…
Reference in New Issue
Block a user