00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __NEPROFILE_H
00028 #define __NEPROFILE_H
00029
00030
00031 #include "base.h"
00032 #include "core.h"
00033 #include "activator.h"
00034 #include "hashstring.h"
00035 #include "callback.h"
00036 #include "renderentity.h"
00037
00038 #include <vector>
00039 #include <string>
00040
00041
00042
00049 namespace NeoEngine
00050 {
00051
00052
00053 #ifdef WIN32
00054 # ifndef __HAVE_VECTOR_PROFILEDATA
00055 UDTVectorEXPIMP( class ProfileData* );
00056 # define __HAVE_VECTOR_PROFILEDATA
00057 # endif
00058 #endif
00059
00060
00061
00072 class NEOENGINE_API ProfileData
00073 {
00074 public:
00075
00077 HashString m_strName;
00078
00080 ProfileData *m_pkParent;
00081
00083 std::vector< ProfileData* > m_vpkChildren;
00084
00086 uint64_t m_ulActivated;
00087
00089 uint64_t m_ulAccTime;
00090
00092 int m_iCount;
00093
00095 int m_iLevel;
00096
00097
00098
00103 ProfileData( const std::string &rstrName, ProfileData *pkParent = 0 );
00104
00108 virtual ~ProfileData();
00109
00113 virtual void Dump();
00114
00119 virtual void DumpToString( std::string *pstrDst );
00120
00124 virtual void Reset();
00125 };
00126
00127
00128
00143 class NEOENGINE_API ProfileManager : public ProfileData, public ConsoleCmdCallback, public RenderEntity, virtual public Activator
00144 {
00145 protected:
00146
00148 ProfileData *m_pkActiveNode;
00149
00150
00151
00152 public:
00153
00154
00157 ProfileManager();
00158
00161 virtual ~ProfileManager();
00162
00167 virtual void BeginProfile( const HashString &rstrName );
00168
00172 virtual void EndProfile();
00173
00177 virtual void Dump();
00178
00183 virtual void DumpToString( std::string *pstrDst );
00184
00188 virtual void Clear();
00189
00195 virtual void ConsoleCmd( const HashString &rstrCmd, const HashString &rstrArgs );
00196
00203 virtual bool Render( Frustum *pkFrustum = 0, bool bForce = false );
00204 };
00205
00206
00207
00208 #ifdef _PROFILE
00209
00210 #define BEGIN_PROFILE( name ) { Core::Get()->GetProfileManager()->BeginProfile( name ); }
00211 #define END_PROFILE() { Core::Get()->GetProfileManager()->EndProfile(); }
00212
00213 #else
00214
00215 #define BEGIN_PROFILE( name )
00216 #define END_PROFILE()
00217
00218 #endif
00219
00220
00221 };
00222
00223
00224 #endif // __NEPROFILE_H