LAMA
/home/brandes/workspace/LAMA/src/lama/solver/logger/OpenMPTimer.hpp
Go to the documentation of this file.
00001 
00033 #ifndef LAMA_OPENMPTIMER_HPP_
00034 #define LAMA_OPENMPTIMER_HPP_
00035 
00036 // for dll_import
00037 #include <lama/config.hpp>
00038 
00039 // base classes
00040 #include <lama/solver/logger/Timer.hpp>
00041 
00042 #include <map>
00043 
00044 namespace lama
00045 {
00046 
00051 class LAMA_DLL_IMPORTEXPORT OpenMPTimer : public Timer
00052 {
00053 public:
00054 
00055     OpenMPTimer();
00056     virtual ~OpenMPTimer();
00057 
00058     void initialize(const std::string& timerId);
00059 
00060     void start(const std::string& timerId);
00061     void stop(const std::string& timerId);
00062 
00063     void reset( const std::string& timerId);
00064 
00065     double getTime(const std::string& timerId);
00066     void stopAndReset(const std::string& timerId);
00067 
00068 private:
00069 
00070     struct TimerData
00071     {
00072         double startTime;
00073         double totalTime;
00074         bool isRunning;
00075 
00076         TimerData() : startTime(0.0), totalTime(0.0), isRunning(false)
00077         {
00078         }
00079     };
00080 
00081     typedef std::map<std::string,TimerData> MapType;
00082     typedef std::pair<std::string,TimerData> PairType;
00083     typedef MapType::iterator MapIteratorType;
00084 
00085     MapType m_timerData;
00086 
00087 };
00088 
00089 }  // namespace lama
00090 
00091 #endif // LAMA_OPENMPTIMER_HPP_