void AstDumpToHtml::view(const char* passName) { fprintf(sIndexFP, "<TR><TD>"); fprintf(sIndexFP, "%s%s[%d]", passName, fdump_html_include_system_modules ? "<br>" : " ", lastNodeIDUsed()); fprintf(sIndexFP, "</TD><TD>"); forv_Vec(ModuleSymbol, module, allModules) { if (fdump_html_include_system_modules == true || module->modTag == MOD_MAIN || module->modTag == MOD_USER) { AstDumpToHtml logger; if (logger.open(module, passName) == true) { for_alist(stmt, module->block->body) stmt->accept(&logger); logger.close(); } } } fprintf(sIndexFP, "</TD></TR>"); fflush(sIndexFP); sPassIndex++; }
static void runPass(const char *passName, void (*pass)(void), void (*check)(), char log_tag) { static struct timeval startTimeBetweenPasses; static struct timeval stopTimeBetweenPasses; static double timeBetweenPasses = -1.0; static double totalTime = 0.0; struct timeval startTime; struct timeval stopTime; struct timezone timezone; static bool performTiming = printPasses || (printPassesFile != NULL); if (performTiming) { gettimeofday(&stopTimeBetweenPasses, &timezone); if (timeBetweenPasses < 0.0) timeBetweenPasses = 0.0; else timeBetweenPasses += ((double)((stopTimeBetweenPasses.tv_sec*1e6+ stopTimeBetweenPasses.tv_usec) - (startTimeBetweenPasses.tv_sec*1e6+ startTimeBetweenPasses.tv_usec))) / 1e6; } if (strlen(fPrintStatistics) && strcmp(passName, "parse")) printStatistics("clean"); if (performTiming) { printPassTiming("%32s :", passName); gettimeofday(&startTime, &timezone); } (*pass)(); if (performTiming) { gettimeofday(&stopTime, &timezone); printPassTiming("%8.3f seconds", ((double)((stopTime.tv_sec*1e6+stopTime.tv_usec) - (startTime.tv_sec*1e6+startTime.tv_usec))) / 1e6); if (developer && printPasses) fprintf(stderr, " [%d]", lastNodeIDUsed()); printPassTiming("\n"); totalTime += ((double)((stopTime.tv_sec*1e6+stopTime.tv_usec) - (startTime.tv_sec*1e6+startTime.tv_usec))) / 1e6; if (!strcmp(passName, "makeBinary")) { printPassTiming("%32s :%8.3f seconds\n", "time between passes", timeBetweenPasses); printPassTiming("%32s :%8.3f seconds\n", "total time", totalTime+timeBetweenPasses); } } if (strlen(fPrintStatistics)) printStatistics(passName); if (fdump_html) { html_view(passName); } if (logging(log_tag)) dump_ast(passName, currentPassNo); if (performTiming) { gettimeofday(&startTimeBetweenPasses, &timezone); } considerExitingEndOfPass(); cleanAst(); (*check)(); // Run per-pass check function. //printPrimitiveCounts(passName); }
void Phase::ReportPass(unsigned long now) const { // clock-skew can cause now < startTime, just report 0 in that case unsigned long phaseTime = 0; if (now > mStartTime) phaseTime = now - mStartTime; ReportTime(mName, phaseTime / 1e6); if (developer == true) { char text[32]; sprintf(text, " [%9d]", lastNodeIDUsed()); ReportText(text); } ReportText("\n"); }