00001 #ifndef MFUTIL_TIMING_H
00002 #define MFUTIL_TIMING_H
00003
00004 #include <map>
00005 #include <string>
00006 #include <sys/timeb.h>
00007 #include <vector>
00008
00009 namespace MFUtil
00010 {
00011
00015 class Timing
00016 {
00017 public:
00018
00023 void startChrono( const std::string& p_description );
00024
00029 void endChrono( const std::string& p_description );
00030
00034 std::string getTiming( const std::string& p_description );
00035
00036 protected:
00037
00041 class Interval
00042 {
00043 public:
00044 Interval( void ) : is_paired( false ) {};
00045 struct timeb starting_time;
00046 struct timeb ending_time;
00047 bool is_paired;
00048
00049 float getElapsedTime( void ) const;
00050 };
00051
00052 private:
00053 std::map< std::string, std::vector<Interval> > m_timing_map;
00054 typedef std::map< std::string, std::vector< Timing::Interval > >::iterator mapit_t;
00055 };
00056
00057 }
00058
00059 #endif
00060 iming::Interval > >::iterator mapit_t;
00061 };
00062
00063 }
00064
00065 #endif