Commits

Sam Skillman committed b3210af

Temporary work-around for timing sections of level>0 methods which may only be reached by a subset of processors. I will need to do some sort of broadcast in the future. Also adding some ifdef's around timing specific code.

  • Participants
  • Parent commits 96d2f34

Comments (0)

Files changed (3)

File src/enzo/EnzoTiming.h

       return timers[name];
     }
 
+    void create(char *name){
+      SectionMap::iterator iter = timers.find(name);
+      if (iter == timers.end()){
+        timers[name] = new section_performance(name);
+      }
+      return;
+    }
+
     // Start a timer by name
     void start(char *name){
-      SectionMap::iterator iter = timers.find(name);
-      if (iter == timers.end()){
-        //fprintf(stderr, "%s Being Created\n", name);
-        timers[name] = new section_performance(name);
-      }
+      this->create(name);
       timers[name]->start();
     }
 
     // Stop a timer by name
     void stop(char *name){
-      SectionMap::iterator iter = timers.find(name);
-      if (iter == timers.end()){
-        //fprintf(stderr, "%s Being Created\n", name);
-        timers[name] = new section_performance(name);
-      }
       timers[name]->stop();
     }
 
 #define TIMER_START(section_name) enzo_timer->start(section_name)
 #define TIMER_STOP(section_name) enzo_timer->stop(section_name)
 #define TIMER_WRITE(cycle_number) enzo_timer->write_out(cycle_number)
+#define TIMER_REGISTER(name) enzo_timer->create(name)
 #else
 #define TIMER_START(section_name)
 #define TIMER_STOP(section_name)
 #define TIMER_WRITE(cycle_number)
+#define TIMER_REGISTER(name)
 #endif
 
 #endif //ENZO_TIMING

File src/enzo/Grid_SolveForPotential.C

 int grid::SolveForPotential(int level, FLOAT PotentialTime)
 {
  
+  TIMER_REGISTER("SolveForPotential");
   /* Return if this grid is not on this processor. */
  
   if (MyProcessorNumber != ProcessorNumber)

File src/enzo/OutputLevelInformation.C

 
   for (level = 0; level <= MaximumRefinementLevel; level++) {
 
+#ifdef ENZO_PERFORMANCE
     enzo_timer->get_level(level)->add_stats(Grids[level], CellsActive[level]);
+#endif
 
     if (isRoot) {
       fprintf(fptr, "  Level %"ISYM"  Grids %"ISYM"  Memory(MB) %"GSYM"  Coverage %"GSYM"  Ratio %"GSYM"  Flagged %"GSYM"  Active %lld\n",