|
//-------------------------------------------------------------------------------------------------------------
#include "includes.h"
#include "function.h"
//-------------------------------------------------------------------------------------------------------------
Function::Function( const TCHAR* name)
: mFuncName( name),
mTotalTime(0.0),
mNumCalls(0),
mChildTime(0.0),
mStartTime(0)
{
}
//-------------------------------------------------------------------------------------------------------------
void Function::addChildTime( float time)
{
mChildTime += time;
}
//-------------------------------------------------------------------------------------------------------------
void Function::addTime( float time)
{
mNumCalls++;
mTotalTime += time;
}
//-------------------------------------------------------------------------------------------------------------
float Function::getTotalTime() const
{
return mTotalTime;
}
//-------------------------------------------------------------------------------------------------------------
float Function::getChildTime() const
{
return mChildTime;
}
//-------------------------------------------------------------------------------------------------------------
const TCHAR* Function::getName() const
{
return mFuncName.c_str();
}
//-------------------------------------------------------------------------------------------------------------
int Function::getCalls() const
{
return mNumCalls;
}
//-------------------------------------------------------------------------------------------------------------
void Function::startTimer()
{
mStartTime = clock();
}
//-------------------------------------------------------------------------------------------------------------
void Function::stopTimer( float &time)
{
clock_t currTime = clock();
time = (float) ( currTime - mStartTime) / CLOCKS_PER_SEC;
mStartTime = 0;
}
//-------------------------------------------------------------------------------------------------------------
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
C/C++ practitioner with more than 5 years of experience in 3D Visualization.