[colobot] 05/74: Added CBot performance counter
Didier Raboud
odyx at moszumanska.debian.org
Mon Nov 7 07:49:59 UTC 2016
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch debian/master
in repository colobot.
commit 2c3e90b126b8bcbb5f092a073bcb9d5822e2c146
Author: krzys-h <krzys_h at interia.pl>
Date: Sun Jul 24 16:36:13 2016 +0200
Added CBot performance counter
---
src/common/profiler.h | 1 +
src/graphics/engine/engine.cpp | 11 +++++++----
src/object/implementation/programmable_impl.cpp | 3 +++
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/common/profiler.h b/src/common/profiler.h
index 6eebc5f..9e22207 100644
--- a/src/common/profiler.h
+++ b/src/common/profiler.h
@@ -36,6 +36,7 @@ enum PerformanceCounter
PCNT_UPDATE_ENGINE, //! < frame update in CEngine
PCNT_UPDATE_PARTICLE, //! < frame update in CParticle
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_PARTICLE, //! < rendering the particles in 3D
diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp
index be1b746..36f0829 100644
--- a/src/graphics/engine/engine.cpp
+++ b/src/graphics/engine/engine.cpp
@@ -5032,7 +5032,7 @@ void CEngine::DrawStats()
float height = m_text->GetAscent(FONT_COLOBOT, 13.0f);
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);
@@ -5083,9 +5083,11 @@ void CEngine::DrawStats()
long long engineUpdate = CProfiler::GetPerformanceCounterTime(PCNT_UPDATE_ENGINE) -
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) -
- engineUpdate -
- CProfiler::GetPerformanceCounterTime(PCNT_UPDATE_PARTICLE) -
+ CProfiler::GetPerformanceCounterTime(PCNT_UPDATE_ENGINE) -
CProfiler::GetPerformanceCounterTime(PCNT_UPDATE_GAME);
long long otherRender = CProfiler::GetPerformanceCounterTime(PCNT_RENDER_ALL) -
@@ -5101,7 +5103,8 @@ void CEngine::DrawStats()
drawStatsCounter("Frame update", PCNT_UPDATE_ALL);
drawStatsValue (" Engine update", engineUpdate);
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);
drawStatsLine( "");
drawStatsCounter("Frame render", PCNT_RENDER_ALL);
diff --git a/src/object/implementation/programmable_impl.cpp b/src/object/implementation/programmable_impl.cpp
index 0fb11ba..f02ba62 100644
--- a/src/object/implementation/programmable_impl.cpp
+++ b/src/object/implementation/programmable_impl.cpp
@@ -22,6 +22,7 @@
#include "CBot/CBot.h"
#include "common/global.h"
+#include "common/profiler.h"
#include "level/robotmain.h"
@@ -74,6 +75,7 @@ bool CProgrammableObjectImpl::EventProcess(const Event &event)
if ( GetActivity() )
{
+ CProfiler::StartPerformanceCounter(PCNT_UPDATE_CBOT);
if ( IsProgram() ) // current program?
{
if ( m_currentProgram->script->Continue() )
@@ -86,6 +88,7 @@ bool CProgrammableObjectImpl::EventProcess(const Event &event)
{
TraceRecordFrame();
}
+ CProfiler::StopPerformanceCounter(PCNT_UPDATE_CBOT);
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git
More information about the Pkg-games-commits
mailing list