Skip to content
Snippets Groups Projects
Commit a7bc1d07 authored by clc5q's avatar clc5q
Browse files

Add timing output for analysis phases.

Former-commit-id: 4f3e70021a2b509b80db0caf8c99b2141896333f
parent 0cb1d0c2
No related branches found
No related tags found
No related merge requests found
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <cstring> #include <cstring>
#include <cstdlib> #include <cstdlib>
#include <cassert> #include <cassert>
#include <ctime>
#include "interfaces/SMPDBInterface.h" #include "interfaces/SMPDBInterface.h"
#include "base/SMPDataFlowAnalysis.h" #include "base/SMPDataFlowAnalysis.h"
...@@ -228,6 +229,7 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn ...@@ -228,6 +229,7 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn
long TotalUntypedPhiDefs = 0; long TotalUntypedPhiDefs = 0;
long TotalSafeFuncs = 0; long TotalSafeFuncs = 0;
size_t TotalInstructions = 0; size_t TotalInstructions = 0;
time_t StartTime = time(NULL), EndTime;
this->ProfInfo = pi; this->ProfInfo = pi;
...@@ -345,6 +347,11 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn ...@@ -345,6 +347,11 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn
SMP_msg("INFO: Number of functions in FuncMap: %zu\n", this->FuncMap.size()); SMP_msg("INFO: Number of functions in FuncMap: %zu\n", this->FuncMap.size());
#endif #endif
EndTime = time(NULL);
double TimeDiff = difftime(EndTime, StartTime);
SMP_msg("INFO: TIME: Phase 1: AnalyzeFunc: %7.2f\n", TimeDiff);
StartTime = time(NULL);
if (global_STARS_program->ShouldSTARSPerformReducedAnalysis()) { if (global_STARS_program->ShouldSTARSPerformReducedAnalysis()) {
this->EmitDataAnnotations(this->AnnotationFile, this->InfoAnnotationFile); this->EmitDataAnnotations(this->AnnotationFile, this->InfoAnnotationFile);
this->GlobalVarTable.clear(); this->GlobalVarTable.clear();
...@@ -366,6 +373,11 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn ...@@ -366,6 +373,11 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn
} // end for all functions in FuncList } // end for all functions in FuncList
} // end for all functions in TempFuncMap } // end for all functions in TempFuncMap
EndTime = time(NULL);
TimeDiff = difftime(EndTime, StartTime);
SMP_msg("INFO: TIME: Phase 2: AdvancedAnalysis: %7.2f\n", TimeDiff);
StartTime = time(NULL);
// In order to reduce memory consumption, emit the global data annotations now, // In order to reduce memory consumption, emit the global data annotations now,
// and then release the memory for the global data. Note that this means we // and then release the memory for the global data. Note that this means we
// cannot presently apply type inference info to the global data table. If we // cannot presently apply type inference info to the global data table. If we
...@@ -375,6 +387,11 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn ...@@ -375,6 +387,11 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn
this->GlobalVarTable.clear(); this->GlobalVarTable.clear();
this->GlobalNameMap.clear(); this->GlobalNameMap.clear();
EndTime = time(NULL);
TimeDiff = difftime(EndTime, StartTime);
SMP_msg("INFO: TIME: Phase 3: EmitDataAnnotations: %7.2f\n", TimeDiff);
StartTime = time(NULL);
#ifndef SMP_REDUCED_ANALYSIS #ifndef SMP_REDUCED_ANALYSIS
// STEP 2: Compute SSA form. // STEP 2: Compute SSA form.
...@@ -407,6 +424,11 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn ...@@ -407,6 +424,11 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn
CurrFunc->FreeUnusedMemory3(); // free memory CurrFunc->FreeUnusedMemory3(); // free memory
} }
EndTime = time(NULL);
TimeDiff = difftime(EndTime, StartTime);
SMP_msg("INFO: TIME: Phase 4: SSA+SCCP+FuncSafe: %7.2f\n", TimeDiff);
StartTime = time(NULL);
#if 0 // need to debug #if 0 // need to debug
// Remove any basic blocks that had a direct indication of being unreachable, e.g. "call 0" instruction. // Remove any basic blocks that had a direct indication of being unreachable, e.g. "call 0" instruction.
// If any function becomes empty as a result, the function is unreachable, so any block calling it // If any function becomes empty as a result, the function is unreachable, so any block calling it
...@@ -446,6 +468,11 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn ...@@ -446,6 +468,11 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn
} }
// end of step 3 // end of step 3
EndTime = time(NULL);
TimeDiff = difftime(EndTime, StartTime);
SMP_msg("INFO: TIME: Phase 5: RetAddrStatus: %7.2f\n", TimeDiff);
StartTime = time(NULL);
for (FuncListIter = this->PrioritizedFuncList.begin(); FuncListIter != this->PrioritizedFuncList.end(); ++FuncListIter) { for (FuncListIter = this->PrioritizedFuncList.begin(); FuncListIter != this->PrioritizedFuncList.end(); ++FuncListIter) {
CurrFunc = (*FuncListIter); CurrFunc = (*FuncListIter);
if (NULL == CurrFunc) { if (NULL == CurrFunc) {
...@@ -536,6 +563,11 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn ...@@ -536,6 +563,11 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn
TotalInstructions += CurrFunc->GetInstCount(); TotalInstructions += CurrFunc->GetInstCount();
} // end for all functions } // end for all functions
EndTime = time(NULL);
TimeDiff = difftime(EndTime, StartTime);
SMP_msg("INFO: TIME: Phase 6: MetaData+InferTypes+InferFG: %7.2f\n", TimeDiff);
StartTime = time(NULL);
#if STARS_INTERPROCEDURAL_TYPE_INFERENCE #if STARS_INTERPROCEDURAL_TYPE_INFERENCE
// STEP 4: Interprocedural type inference and propagation. // STEP 4: Interprocedural type inference and propagation.
SMP_msg("Performing interprocedural type inference.\n"); SMP_msg("Performing interprocedural type inference.\n");
...@@ -582,6 +614,10 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn ...@@ -582,6 +614,10 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn
#endif #endif
EndTime = time(NULL);
TimeDiff = difftime(EndTime, StartTime);
SMP_msg("INFO: TIME: Phase 7: InterproceduralTypes: %7.2f\n", TimeDiff);
// Free memory not needed to emit annotations, now that type inference is done. // Free memory not needed to emit annotations, now that type inference is done.
CurrFunc->FreeUnusedMemory4(); CurrFunc->FreeUnusedMemory4();
...@@ -728,6 +764,7 @@ void SMPProgram::EmitDataAnnotations(FILE *AnnotFile, FILE *InfoAnnotFile) { ...@@ -728,6 +764,7 @@ void SMPProgram::EmitDataAnnotations(FILE *AnnotFile, FILE *InfoAnnotFile) {
void SMPProgram::EmitAnnotations(FILE *AnnotFile, FILE *InfoAnnotFile) { void SMPProgram::EmitAnnotations(FILE *AnnotFile, FILE *InfoAnnotFile) {
long TotalSafeBlocks = 0; // basic blocks with no unsafe writes long TotalSafeBlocks = 0; // basic blocks with no unsafe writes
long TotalUnsafeBlocks = 0; // basic blocks with unsafe writes long TotalUnsafeBlocks = 0; // basic blocks with unsafe writes
time_t StartTime = time(NULL), EndTime;
// Mark exception-handling functions as unsafe for fast returns. // Mark exception-handling functions as unsafe for fast returns.
if (this->ProgramThrowsExceptions()) { if (this->ProgramThrowsExceptions()) {
...@@ -749,6 +786,10 @@ void SMPProgram::EmitAnnotations(FILE *AnnotFile, FILE *InfoAnnotFile) { ...@@ -749,6 +786,10 @@ void SMPProgram::EmitAnnotations(FILE *AnnotFile, FILE *InfoAnnotFile) {
#endif #endif
} // end for all functions } // end for all functions
EndTime = time(NULL);
double TimeDiff = difftime(EndTime, StartTime);
SMP_msg("INFO: TIME: Phase 8: EmitAnnotations: %7.2f\n", TimeDiff);
#if ZST_EMIT_SPARK_ADA_TRANSLATION #if ZST_EMIT_SPARK_ADA_TRANSLATION
SMP_msg("SPARK: Total subword registers translated: %lu\n", SubwordRegCount); SMP_msg("SPARK: Total subword registers translated: %lu\n", SubwordRegCount);
SMP_msg("SPARK: Total subword memory accesses translated: %lu\n", SubwordMemCount); SMP_msg("SPARK: Total subword memory accesses translated: %lu\n", SubwordMemCount);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment