#ifndef BU_PROFILER_H #define BU_PROFILER_H #include "bu/blob.h" #include "bu/hash.h" #include "bu/list.h" #include "bu/mutex.h" #include "bu/singleton.h" namespace Bu { class Profiler : public Bu::Singleton { friend class Bu::Singleton; private: Profiler(); virtual ~Profiler(); public: static uint64_t getMicroTime(); void startEvent( const Bu::Blob &bName ); void endEvent( const Bu::Blob &bName ); void printReport() const; private: class Event { public: Event(); Event( const Event &rSrc ); ~Event(); void end(); bool hasEnded() const; uint64_t getStart() const; uint64_t getEnd() const; uint64_t getSpan() const; private: uint64_t iStart; uint64_t iStop; }; typedef Bu::List EventList; typedef Bu::Hash EventListHash; EventListHash hEvent; mutable Bu::Mutex mLock; }; }; #endif