diff options
-rw-r--r-- | src/const/utils/perfstat.h | 1 | ||||
-rw-r--r-- | src/progs/manaplus/client.cpp | 17 | ||||
-rw-r--r-- | src/utils/perfstat.cpp | 8 |
3 files changed, 15 insertions, 11 deletions
diff --git a/src/const/utils/perfstat.h b/src/const/utils/perfstat.h index 9f7430516..fac9f7382 100644 --- a/src/const/utils/perfstat.h +++ b/src/const/utils/perfstat.h @@ -25,5 +25,6 @@ static const int PERFSTAT_MAX = 120; static const int PERFSTAT_LAST_STAT = 13; +static const int PERFSTAT_FPS_STAT = 12; #endif // CONST_UTILS_PERFSTAT_H diff --git a/src/progs/manaplus/client.cpp b/src/progs/manaplus/client.cpp index 01348db2d..376097a2e 100644 --- a/src/progs/manaplus/client.cpp +++ b/src/progs/manaplus/client.cpp @@ -1032,13 +1032,6 @@ int Client::gameExec() PERF_STAT(9); - BLOCK_START("~Client::SDL_framerateDelay") - if (settings.limitFps) - SDL_framerateDelay(&fpsManager); - BLOCK_END("~Client::SDL_framerateDelay") - - PERF_STAT(10); - BLOCK_START("Client::gameExec 6") if (mState == State::CONNECT_GAME) { @@ -1063,7 +1056,7 @@ int Client::gameExec() } BLOCK_END("Client::gameExec 6") - PERF_STAT(11); + PERF_STAT(10); if (mState != mOldState) { @@ -1688,6 +1681,14 @@ int Client::gameExec() } BLOCK_END("Client::gameExec 8") } + + PERF_STAT(11); + + BLOCK_START("~Client::SDL_framerateDelay") + if (settings.limitFps) + SDL_framerateDelay(&fpsManager); + BLOCK_END("~Client::SDL_framerateDelay") + PERF_STAT(12); PERF_NEXTFRAME(); PROFILER_END(); diff --git a/src/utils/perfstat.cpp b/src/utils/perfstat.cpp index 839fc7291..479e97033 100644 --- a/src/utils/perfstat.cpp +++ b/src/utils/perfstat.cpp @@ -88,7 +88,7 @@ namespace Perf { if (f == perfFrameId) continue; - const int time1 = Perf::getTime(f, PERFSTAT_LAST_STAT - 1); + const int time1 = Perf::getTime(f, PERFSTAT_FPS_STAT - 1); if (time1 > time) { time = time1; @@ -99,8 +99,10 @@ namespace Perf { worstFrameStats = perfStats[index]; logger->log("worst frame: %d, %d", - perfStats[index].ticks[PERFSTAT_LAST_STAT - 1], - worstFrameStats.ticks[PERFSTAT_LAST_STAT - 1]); + perfStats[index].ticks[PERFSTAT_FPS_STAT - 1] - + perfStats[index].ticks[0], + worstFrameStats.ticks[PERFSTAT_FPS_STAT - 1] - + worstFrameStats.ticks[0]); worstTime = time; } } |