#include <profiler.h>
Public Member Functions | |
void | beginProfile (const std::string &where) |
void | endProfile (const std::string &where) |
const std::string & | getClassName () const |
Returns name of class of our object. | |
const std::string & | getObjectName () const |
Returns name of our object. | |
double | getProfilingTime (const std::string &where) |
void | getSpecificParameter (const std::string &ParameterName, void *ParameterValue) |
Method for obtaining some specific parameters, such as texture specific params, and so on. | |
bool | isLocked () const |
returns state of object. | |
template<> | |
Timer * | mSingleton |
template<> | |
Timer * | mSingleton |
template<> | |
Profiler * | mSingleton |
template<> | |
LogManager * | mSingleton |
template<> | |
debugger::Debugger * | mSingleton |
template<> | |
debugger::CommandParser * | mSingleton |
template<> | |
Application * | mSingleton |
Profiler () | |
~Profiler () | |
Static Public Member Functions | |
static Profiler & | getSingleton () |
Override standard Singleton retrieval. | |
static Profiler * | getSingletonPtr () |
Protected Member Functions | |
void | addSpecificParameter (const std::string &ParameterName, void *ParameterValue, size_t Size) |
void | lock () |
void | unlock () |
Static Protected Attributes | |
static T * | mSingleton |
Private Types | |
typedef std::pair< double, double > | ProfileEntry |
typedef std::map< std::string, ProfileEntry > | ProfileMap |
Private Attributes | |
ProfileMap | mProfileMap |
Definition at line 46 of file profiler.h.
typedef std::pair<double, double> gpucalc::Profiler::ProfileEntry [private] |
Definition at line 121 of file profiler.h.
typedef std::map<std::string, ProfileEntry> gpucalc::Profiler::ProfileMap [private] |
Definition at line 122 of file profiler.h.
gpucalc::Profiler::Profiler | ( | ) | [inline] |
Definition at line 55 of file profiler.h.
00055 : Singleton<Profiler>(_ProfilerName) 00056 { 00057 }
gpucalc::Profiler::~Profiler | ( | ) | [inline] |
void gpucalc::Object::addSpecificParameter | ( | const std::string & | ParameterName, | |
void * | ParameterValue, | |||
size_t | Size | |||
) | [inline, protected, inherited] |
Definition at line 254 of file object.h.
00255 { 00256 SpecificParametersMap::iterator i = mSpecificParameters.find(ParameterName); 00257 if (i != mSpecificParameters.end()) 00258 { 00259 mSpecificParameters.erase(i); 00260 } 00261 mSpecificParameters[ParameterName] = Any(ParameterValue, Size); 00262 }
void gpucalc::Profiler::beginProfile | ( | const std::string & | where | ) | [inline] |
Definition at line 65 of file profiler.h.
00066 { 00067 if (!addToContainer(std::make_pair(Timer::getSingleton().getTime(), -1.0), where, mProfileMap)) 00068 { 00069 Warning<ERR_DUPLICATE_ITEM>(this, "Profile label \"" + where + "\" already exists. Profiling does not start.", "Profiler::beginProfile()", __FILE__, __LINE__); 00070 } 00071 }
void gpucalc::Profiler::endProfile | ( | const std::string & | where | ) | [inline] |
Definition at line 74 of file profiler.h.
00075 { 00076 double stop = Timer::getSingleton().getTime(); 00077 00078 ProfileMap::iterator i = mProfileMap.find(where); 00079 if (i == mProfileMap.end()) 00080 { 00081 Warning<ERR_ITEM_NOT_FOUND>(this, "Profile label \"" + where + "\" cannot be found.", "Profiler::endProfile()", __FILE__, __LINE__); 00082 } 00083 else 00084 { 00085 i->second.second = stop;// = std::make_pair(i->second.first, stop); 00086 } 00087 }
const std::string& gpucalc::Object::getClassName | ( | ) | const [inline, inherited] |
Returns name of class of our object.
Definition at line 92 of file object.h.
00093 { 00094 return mClassName; 00095 }
const std::string& gpucalc::Object::getObjectName | ( | ) | const [inline, inherited] |
Returns name of our object.
Definition at line 101 of file object.h.
00102 { 00103 return mObjectName; 00104 }
double gpucalc::Profiler::getProfilingTime | ( | const std::string & | where | ) | [inline] |
Definition at line 95 of file profiler.h.
00096 { 00097 ProfileMap::iterator i = mProfileMap.find(where); 00098 if (i == mProfileMap.end()) 00099 { 00100 Warning<ERR_ITEM_NOT_FOUND>(this, "Profile label \"" + where + "\" cannot be found.", "Profiler::endProfile()", __FILE__, __LINE__); 00101 return -1.0; 00102 } 00103 else 00104 { 00105 if (i->second.second > 0.0) 00106 { 00107 double result = i->second.second - i->second.first; 00108 mProfileMap.erase(i); 00109 return result; 00110 } 00111 else 00112 { 00113 Except<ERR_INVALID_STATE>(this, "Profiling \"" + where + "\" is not stopped yet.", "Profiler::getProfilingTime()", __FILE__, __LINE__); 00114 return -1.0; 00115 } 00116 } 00117 }
Profiler & gpucalc::Profiler::getSingleton | ( | ) | [static] |
Override standard Singleton retrieval.
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.
This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.
Reimplemented from gpucalc::Singleton< T >.
Definition at line 48 of file profiler.cpp.
00049 { 00050 assert(mSingleton); 00051 return(* mSingleton); 00052 }
Profiler * gpucalc::Profiler::getSingletonPtr | ( | ) | [static] |
Override standard Singleton retrieval.
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.
This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.
Reimplemented from gpucalc::Singleton< T >.
Definition at line 42 of file profiler.cpp.
00043 { 00044 return mSingleton; 00045 }
void gpucalc::Object::getSpecificParameter | ( | const std::string & | ParameterName, | |
void * | ParameterValue | |||
) | [inline, inherited] |
Method for obtaining some specific parameters, such as texture specific params, and so on.
ParameterName | - name of parameter, usually it similar to specific method of some object (for example, GLTextureID) | |
ParameterValue | - contain value of named parameter, it must be allocated and have sufficient size. |
Definition at line 128 of file object.h.
00129 { 00130 SpecificParametersMap::iterator i = mSpecificParameters.find(ParameterName); 00131 if (i != mSpecificParameters.end()) 00132 { 00133 i->second.copyValue(ParameterValue); 00134 } 00135 else 00136 { 00137 Except<ERR_ITEM_NOT_FOUND>(this, "Parameter \"" + ParameterName + "\" does not exists.", "Object::getSpecificParameter()", __FILE__, __LINE__); 00138 } 00139 }
bool gpucalc::Object::isLocked | ( | ) | const [inline, inherited] |
void gpucalc::Object::lock | ( | ) | [inline, protected, inherited] |
Timer * gpucalc::Singleton< Timer >::mSingleton | ( | ) | [inline, inherited] |
Definition at line 42 of file win32_timer_impl.cpp.
Timer * gpucalc::Singleton< Timer >::mSingleton | ( | ) | [inline, inherited] |
Definition at line 45 of file unix_timer_impl.cpp.
Profiler * gpucalc::Singleton< Profiler >::mSingleton | ( | ) | [inline, inherited] |
Definition at line 39 of file profiler.cpp.
LogManager * gpucalc::Singleton< LogManager >::mSingleton | ( | ) | [inline, inherited] |
Definition at line 38 of file log_manager.cpp.
debugger::Debugger * gpucalc::Singleton< debugger::Debugger >::mSingleton | ( | ) | [inline, inherited] |
Definition at line 42 of file debugger.cpp.
debugger::CommandParser * gpucalc::Singleton< debugger::CommandParser >::mSingleton | ( | ) | [inline, inherited] |
Definition at line 41 of file command_parser.cpp.
Application * gpucalc::Singleton< Application >::mSingleton | ( | ) | [inline, inherited] |
Definition at line 44 of file application.cpp.
void gpucalc::Object::unlock | ( | ) | [inline, protected, inherited] |
ProfileMap gpucalc::Profiler::mProfileMap [private] |
Definition at line 123 of file profiler.h.
T* gpucalc::Singleton< T >::mSingleton [static, protected, inherited] |
Definition at line 108 of file singleton.h.