ff_i_profiler
Profiling functions.
Wrappers around NWNX_Profiler to push and pop named timing scopes.
Output is written to the server log.
-
int StartProfileTimer()
Start a profiling timer.
-
int StopProfileTimer(int nStart)
- Parameters:
nStart – Value returned by StartProfileTimer().
Stop the timer and return the timing.
-
string ProfileTimeToString(int nMicroSeconds)
- Parameters:
nMicroSeconds – Value returned by StopProfileTimer().
Convert the time of StopProfileTimer to a string.
Source code
// @code
#include "ff_i_string"
// -----------------------------------------------------------------------------
//! @brief Start a profiling timer
int StartProfileTimer();
int StartProfileTimer()
{
return GetMicrosecondCounter();
}
// -----------------------------------------------------------------------------
//! @brief Stop the timer and return the timing
//! @param nStart Value returned by StartProfileTimer().
int StopProfileTimer(int nStart);
int StopProfileTimer(int nStart)
{
int nNow = GetMicrosecondCounter();
int nDiff = nNow - nStart;
return nDiff;
}
// -----------------------------------------------------------------------------
//! @brief Convert the time of StopProfileTimer to a string
//! @param nMicroSeconds Value returned by StopProfileTimer().
string ProfileTimeToString(int nMicroSeconds);
string ProfileTimeToString(int nMicroSeconds)
{
float fMilliseconds = IntToFloat(nMicroSeconds) / 1000.0;
return FloatToString(fMilliseconds, 3, 3);
}