mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
ud.showfps > 2 now shows Game Update time and Game Update & Draw time (along with the min & max Game Update time) for easier performance analysis
git-svn-id: https://svn.eduke32.com/eduke32@6882 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
fdaf5a8ac7
commit
3ad44df555
5 changed files with 35 additions and 2 deletions
|
@ -638,7 +638,7 @@ void G_DoCheats(void)
|
|||
return;
|
||||
|
||||
case CHEAT_RATE:
|
||||
if (ud.showfps++ > 2)
|
||||
if (++ud.showfps > 3)
|
||||
ud.showfps = 0;
|
||||
|
||||
end_cheat(pPlayer);
|
||||
|
|
|
@ -6748,6 +6748,8 @@ MAIN_LOOP_RESTART:
|
|||
|
||||
OSD_DispatchQueued();
|
||||
|
||||
char gameUpdate = false;
|
||||
uint32_t gameUpdateStartTime = timerGetTicks();
|
||||
if (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && totalclock >= ototalclock+TICSPERFRAME)
|
||||
{
|
||||
if (g_networkMode != NET_DEDICATED_SERVER)
|
||||
|
@ -6793,6 +6795,9 @@ MAIN_LOOP_RESTART:
|
|||
}
|
||||
}
|
||||
while (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && totalclock >= ototalclock+TICSPERFRAME);
|
||||
|
||||
gameUpdate = true;
|
||||
g_gameUpdateTime = timerGetTicks()-gameUpdateStartTime;
|
||||
}
|
||||
|
||||
G_DoCheats();
|
||||
|
@ -6823,6 +6828,11 @@ MAIN_LOOP_RESTART:
|
|||
if (videoGetRenderMode() >= REND_POLYMOST)
|
||||
G_DrawBackground();
|
||||
G_DisplayRest(smoothRatio);
|
||||
|
||||
if (gameUpdate)
|
||||
{
|
||||
g_gameUpdateAndDrawTime = timerGetTicks()-gameUpdateStartTime;
|
||||
}
|
||||
}
|
||||
|
||||
// handle CON_SAVE and CON_SAVENN
|
||||
|
|
|
@ -161,6 +161,8 @@ G_EXTERN projectile_t SpriteProjectile[MAXSPRITES];
|
|||
G_EXTERN sound_t g_sounds[MAXSOUNDS];
|
||||
G_EXTERN uint32_t everyothertime;
|
||||
G_EXTERN uint32_t g_moveThingsCount;
|
||||
G_EXTERN uint32_t g_gameUpdateTime;
|
||||
G_EXTERN uint32_t g_gameUpdateAndDrawTime;
|
||||
|
||||
#ifndef global_c_
|
||||
extern char CheatKeys[2];
|
||||
|
|
|
@ -1705,7 +1705,7 @@ int32_t registerosdcommands(void)
|
|||
|
||||
{ "r_camrefreshdelay", "minimum delay between security camera sprite updates, 120 = 1 second", (void *)&ud.camera_time, CVAR_INT, 1, 240 },
|
||||
{ "r_drawweapon", "enable/disable weapon drawing", (void *)&ud.drawweapon, CVAR_INT, 0, 2 },
|
||||
{ "r_showfps", "show the frame rate counter", (void *)&ud.showfps, CVAR_INT, 0, 2 },
|
||||
{ "r_showfps", "show the frame rate counter", (void *)&ud.showfps, CVAR_INT, 0, 3 },
|
||||
{ "r_shadows", "enable/disable sprite and model shadows", (void *)&ud.shadows, CVAR_BOOL, 0, 1 },
|
||||
{ "r_size", "change size of viewable area", (void *)&ud.screen_size, CVAR_INT|CVAR_FUNCPTR, 0, 64 },
|
||||
{ "r_rotatespritenowidescreen", "pass bit 1024 to all CON rotatesprite calls", (void *)&g_rotatespriteNoWidescreen, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
|
||||
|
|
|
@ -777,6 +777,7 @@ static void G_ShowCacheLocks(void)
|
|||
}
|
||||
|
||||
#define LOW_FPS 30
|
||||
#define SLOW_FRAME_TIME 33
|
||||
|
||||
#if defined GEKKO
|
||||
# define FPS_YOFFSET 16
|
||||
|
@ -790,6 +791,7 @@ static void G_PrintFPS(void)
|
|||
{
|
||||
static int32_t frameCount = 0, lastFPS = 0, lastFrameTime = 0, cumulativeFrameDelay = 0;
|
||||
static int32_t minFPS = -1, maxFPS = 0;
|
||||
static uint32_t minGameUpdate = -1, maxGameUpdate = 0;
|
||||
|
||||
int32_t frameTime = timerGetTicks();
|
||||
int32_t frameDelay = frameTime - lastFrameTime;
|
||||
|
@ -821,6 +823,23 @@ static void G_PrintFPS(void)
|
|||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+20+FPS_YOFFSET,
|
||||
FPS_COLOR(minFPS < LOW_FPS), -1, tempbuf, x);
|
||||
}
|
||||
if (ud.showfps > 2)
|
||||
{
|
||||
if (g_gameUpdateTime > maxGameUpdate) maxGameUpdate = g_gameUpdateTime;
|
||||
if (g_gameUpdateTime < minGameUpdate) minGameUpdate = g_gameUpdateTime;
|
||||
|
||||
chars = Bsprintf(tempbuf, "Game Update: %2d ms GU & Draw: %2d ms", g_gameUpdateTime, g_gameUpdateAndDrawTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+30+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+30+FPS_YOFFSET,
|
||||
FPS_COLOR(g_gameUpdateAndDrawTime >= SLOW_FRAME_TIME), -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "Min Game Update: %2d ms Max Game Update: %2d ms", minGameUpdate, maxGameUpdate);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+40+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+40+FPS_YOFFSET,
|
||||
FPS_COLOR(maxGameUpdate >= SLOW_FRAME_TIME), -1, tempbuf, x);
|
||||
}
|
||||
|
||||
// lag meter
|
||||
if (g_netClientPeer)
|
||||
|
@ -849,6 +868,8 @@ static void G_PrintFPS(void)
|
|||
{
|
||||
maxFPS = (lastFPS + maxFPS) >> 1;
|
||||
minFPS = (lastFPS + minFPS) >> 1;
|
||||
maxGameUpdate = (g_gameUpdateTime + maxGameUpdate) >> 1;
|
||||
minGameUpdate = (g_gameUpdateTime + minGameUpdate) >> 1;
|
||||
secondCounter = 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue