Fix incorrect values caused by outdated use of timing functions in perfstats 3

This commit is contained in:
Hannu Hanhi 2021-04-16 00:38:34 +03:00
parent 99c773f39e
commit 3670af5a31
3 changed files with 5 additions and 5 deletions

View File

@ -473,7 +473,7 @@ void LUAh_ThinkFrame(void)
hook_p hookp;
// variables used by perf stats
int hook_index = 0;
int time_taken = 0;
precise_t time_taken = 0;
if (!gL || !(hooksAvailable[hook_ThinkFrame/8] & (1<<(hook_ThinkFrame%8))))
return;

View File

@ -62,7 +62,7 @@ int thinkframe_hooks_capacity = 16;
static INT32 draw_row;
void PS_SetThinkFrameHookInfo(int index, UINT32 time_taken, char* short_src)
void PS_SetThinkFrameHookInfo(int index, precise_t time_taken, char* short_src)
{
if (!thinkframe_hooks)
{
@ -565,7 +565,7 @@ void M_DrawPerfStats(void)
len = (int)strlen(str);
if (len > 20)
str += len - 20;
snprintf(s, sizeof s - 1, "%20s: %u", str, thinkframe_hooks[i].time_taken);
snprintf(s, sizeof s - 1, "%20s: %d", str, I_PreciseToMicros(thinkframe_hooks[i].time_taken));
V_DrawSmallString(x, y, V_MONOSPACE | V_ALLOWLOWERCASE | text_color, s);
y += 4; // repeated code!
if (y > 192)

View File

@ -30,11 +30,11 @@ extern int ps_lua_mobjhooks;
typedef struct
{
UINT32 time_taken;
precise_t time_taken;
char short_src[LUA_IDSIZE];
} ps_hookinfo_t;
void PS_SetThinkFrameHookInfo(int index, UINT32 time_taken, char* short_src);
void PS_SetThinkFrameHookInfo(int index, precise_t time_taken, char* short_src);
void M_DrawPerfStats(void);