Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

profile.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                            profile.h  -  Profiler
00003                              -------------------
00004     begin                : Sat Aug 31 2002
00005     copyright            : (C) 2002 by Reality Rift Studios
00006     email                : mattias@realityrift.com
00007  ***************************************************************************
00008 
00009  The contents of this file are subject to the Mozilla Public License Version
00010  1.1 (the "License"); you may not use this file except in compliance with
00011  the License. You may obtain a copy of the License at 
00012  http://www.mozilla.org/MPL/
00013 
00014  Software distributed under the License is distributed on an "AS IS" basis,
00015  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00016  for the specific language governing rights and limitations under the
00017  License.
00018 
00019  The Original Code is the NeoEngine, profile.h
00020 
00021  The Initial Developer of the Original Code is Mattias Jansson.
00022  Portions created by Mattias Jansson are Copyright (C) 2002
00023  Reality Rift Studios. All Rights Reserved.
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 }; // namespace NeoEngine
00222 
00223 
00224 #endif  // __NEPROFILE_H

Generated on Wed Jan 21 14:21:07 2004 for NeoEngine by doxygen 1.3.5