00001 // QMcBeaver 00002 // 00003 // Constructed by 00004 // 00005 // Michael Todd Feldmann 00006 // and 00007 // David Randall "Chip" Kent IV 00008 // 00009 // Copyright 2002. All rights reserved. 00010 // 00011 // drkent@users.sourceforge.net mtfeldmann@users.sourceforge.net 00012 00013 #ifndef QMCStopwatches_H 00014 #define QMCStopwatches_H 00015 00016 #include "Stopwatch.h" 00017 00018 #ifdef PARALLEL 00019 #include <mpi.h> 00020 #endif 00021 00022 using namespace std; 00023 00029 class QMCStopwatches 00030 { 00031 private: 00032 Stopwatch Initialization; 00033 Stopwatch Equilibration; 00034 Stopwatch Propagation; 00035 Stopwatch Communication_send; 00036 Stopwatch Communication_reduce; 00037 Stopwatch Communication_synch; 00038 Stopwatch Communication_poll; 00039 Stopwatch Optimization; 00040 Stopwatch Total; 00041 00042 public: 00043 00048 QMCStopwatches(); 00049 00054 void stop(); 00055 00060 void reset(); 00061 00066 Stopwatch * getInitializationStopwatch(); 00067 00072 Stopwatch * getEquilibrationStopwatch(); 00073 00081 Stopwatch * getPropagationStopwatch(); 00082 00090 Stopwatch * getSendCommandStopwatch(); 00091 00099 Stopwatch * getGatherPropertiesStopwatch(); 00100 00107 Stopwatch * getCommunicationSynchronizationStopwatch(); 00108 00116 Stopwatch * getCommandPollingStopwatch(); 00117 00124 Stopwatch * getOptimizationStopwatch(); 00125 00132 Stopwatch * getTotalTimeStopwatch(); 00133 00138 void operator = ( const QMCStopwatches &rhs); 00139 00144 QMCStopwatches operator+(QMCStopwatches & rhs); 00145 00151 friend ostream& operator <<(ostream& strm, QMCStopwatches & rhs); 00152 00153 #ifdef PARALLEL 00154 00155 private: 00156 00161 static bool mpiTypeCreated; 00162 00167 static void buildMpiType(); 00168 00173 static void buildMpiReduce(); 00174 00179 static void Reduce_Function(QMCStopwatches *in, QMCStopwatches *inout, 00180 int *len, MPI_Datatype *dptr); 00181 00182 public: 00183 00188 static MPI_Datatype MPI_TYPE; 00189 00194 static MPI_Op MPI_REDUCE; 00195 00196 #endif 00197 00198 00199 }; 00200 00201 #endif 00202 00203 00204 00205 00206