Added CBot performance counter
parent
5fea22ff03
commit
2c3e90b126
|
@ -36,6 +36,7 @@ enum PerformanceCounter
|
||||||
PCNT_UPDATE_ENGINE, //! < frame update in CEngine
|
PCNT_UPDATE_ENGINE, //! < frame update in CEngine
|
||||||
PCNT_UPDATE_PARTICLE, //! < frame update in CParticle
|
PCNT_UPDATE_PARTICLE, //! < frame update in CParticle
|
||||||
PCNT_UPDATE_GAME, //! < frame update in CRobotMain
|
PCNT_UPDATE_GAME, //! < frame update in CRobotMain
|
||||||
|
PCNT_UPDATE_CBOT, //! < running CBot code (part of CRobotMain update)
|
||||||
|
|
||||||
PCNT_RENDER_ALL, //! < the whole rendering process
|
PCNT_RENDER_ALL, //! < the whole rendering process
|
||||||
PCNT_RENDER_PARTICLE, //! < rendering the particles in 3D
|
PCNT_RENDER_PARTICLE, //! < rendering the particles in 3D
|
||||||
|
|
|
@ -5032,7 +5032,7 @@ void CEngine::DrawStats()
|
||||||
|
|
||||||
float height = m_text->GetAscent(FONT_COLOBOT, 13.0f);
|
float height = m_text->GetAscent(FONT_COLOBOT, 13.0f);
|
||||||
float width = 0.4f;
|
float width = 0.4f;
|
||||||
const int TOTAL_LINES = 20;
|
const int TOTAL_LINES = 21;
|
||||||
|
|
||||||
Math::Point pos(0.05f * m_size.x/m_size.y, 0.05f + TOTAL_LINES * height);
|
Math::Point pos(0.05f * m_size.x/m_size.y, 0.05f + TOTAL_LINES * height);
|
||||||
|
|
||||||
|
@ -5083,9 +5083,11 @@ void CEngine::DrawStats()
|
||||||
long long engineUpdate = CProfiler::GetPerformanceCounterTime(PCNT_UPDATE_ENGINE) -
|
long long engineUpdate = CProfiler::GetPerformanceCounterTime(PCNT_UPDATE_ENGINE) -
|
||||||
CProfiler::GetPerformanceCounterTime(PCNT_UPDATE_PARTICLE);
|
CProfiler::GetPerformanceCounterTime(PCNT_UPDATE_PARTICLE);
|
||||||
|
|
||||||
|
long long gameUpdate = CProfiler::GetPerformanceCounterTime(PCNT_UPDATE_GAME) -
|
||||||
|
CProfiler::GetPerformanceCounterTime(PCNT_UPDATE_CBOT);
|
||||||
|
|
||||||
long long otherUpdate = CProfiler::GetPerformanceCounterTime(PCNT_UPDATE_ALL) -
|
long long otherUpdate = CProfiler::GetPerformanceCounterTime(PCNT_UPDATE_ALL) -
|
||||||
engineUpdate -
|
CProfiler::GetPerformanceCounterTime(PCNT_UPDATE_ENGINE) -
|
||||||
CProfiler::GetPerformanceCounterTime(PCNT_UPDATE_PARTICLE) -
|
|
||||||
CProfiler::GetPerformanceCounterTime(PCNT_UPDATE_GAME);
|
CProfiler::GetPerformanceCounterTime(PCNT_UPDATE_GAME);
|
||||||
|
|
||||||
long long otherRender = CProfiler::GetPerformanceCounterTime(PCNT_RENDER_ALL) -
|
long long otherRender = CProfiler::GetPerformanceCounterTime(PCNT_RENDER_ALL) -
|
||||||
|
@ -5101,7 +5103,8 @@ void CEngine::DrawStats()
|
||||||
drawStatsCounter("Frame update", PCNT_UPDATE_ALL);
|
drawStatsCounter("Frame update", PCNT_UPDATE_ALL);
|
||||||
drawStatsValue (" Engine update", engineUpdate);
|
drawStatsValue (" Engine update", engineUpdate);
|
||||||
drawStatsCounter(" Particle update", PCNT_UPDATE_PARTICLE);
|
drawStatsCounter(" Particle update", PCNT_UPDATE_PARTICLE);
|
||||||
drawStatsCounter(" Game update", PCNT_UPDATE_GAME);
|
drawStatsValue (" Game update", gameUpdate);
|
||||||
|
drawStatsCounter(" CBot programs", PCNT_UPDATE_CBOT);
|
||||||
drawStatsValue( " Other update", otherUpdate);
|
drawStatsValue( " Other update", otherUpdate);
|
||||||
drawStatsLine( "");
|
drawStatsLine( "");
|
||||||
drawStatsCounter("Frame render", PCNT_RENDER_ALL);
|
drawStatsCounter("Frame render", PCNT_RENDER_ALL);
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "CBot/CBot.h"
|
#include "CBot/CBot.h"
|
||||||
|
|
||||||
#include "common/global.h"
|
#include "common/global.h"
|
||||||
|
#include "common/profiler.h"
|
||||||
|
|
||||||
#include "level/robotmain.h"
|
#include "level/robotmain.h"
|
||||||
|
|
||||||
|
@ -74,6 +75,7 @@ bool CProgrammableObjectImpl::EventProcess(const Event &event)
|
||||||
|
|
||||||
if ( GetActivity() )
|
if ( GetActivity() )
|
||||||
{
|
{
|
||||||
|
CProfiler::StartPerformanceCounter(PCNT_UPDATE_CBOT);
|
||||||
if ( IsProgram() ) // current program?
|
if ( IsProgram() ) // current program?
|
||||||
{
|
{
|
||||||
if ( m_currentProgram->script->Continue() )
|
if ( m_currentProgram->script->Continue() )
|
||||||
|
@ -86,6 +88,7 @@ bool CProgrammableObjectImpl::EventProcess(const Event &event)
|
||||||
{
|
{
|
||||||
TraceRecordFrame();
|
TraceRecordFrame();
|
||||||
}
|
}
|
||||||
|
CProfiler::StopPerformanceCounter(PCNT_UPDATE_CBOT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue