Use timerGetHiTicks() instead of timerGetTicks() for timing in osdfunc_fileinfo()

git-svn-id: https://svn.eduke32.com/eduke32@8141 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-10-19 23:41:44 +00:00 committed by Christoph Oelckers
parent 85dd8e31a5
commit 70171ea341

View file

@ -282,7 +282,7 @@ static int osdfunc_fileinfo(osdcmdptr_t parm)
return OSDCMD_OK; return OSDCMD_OK;
} }
int32_t crctime = timerGetTicks(); double crctime = timerGetHiTicks();
uint32_t crcval = 0; uint32_t crcval = 0;
int32_t siz = 0; int32_t siz = 0;
@ -296,11 +296,11 @@ static int osdfunc_fileinfo(osdcmdptr_t parm)
} }
while (siz == ReadSize); while (siz == ReadSize);
crctime = timerGetTicks() - crctime; crctime = timerGetHiTicks() - crctime;
klseek(h, 0, BSEEK_SET); klseek(h, 0, BSEEK_SET);
int32_t xxhtime = timerGetTicks(); double xxhtime = timerGetHiTicks();
XXH32_state_t xxh; XXH32_state_t xxh;
XXH32_reset(&xxh, 0x1337); XXH32_reset(&xxh, 0x1337);
@ -313,17 +313,17 @@ static int osdfunc_fileinfo(osdcmdptr_t parm)
while (siz == ReadSize); while (siz == ReadSize);
uint32_t const xxhash = XXH32_digest(&xxh); uint32_t const xxhash = XXH32_digest(&xxh);
xxhtime = timerGetTicks() - xxhtime; xxhtime = timerGetHiTicks() - xxhtime;
Xfree(buf); Xfree(buf);
OSD_Printf("fileinfo: %s\n" OSD_Printf("fileinfo: %s\n"
" File size: %d\n" " File size: %d bytes\n"
" CRC-32: %08X (%g sec)\n" " CRC-32: %08X (%.1fms)\n"
" xxHash: %08X (%g sec)\n", " xxHash: %08X (%.1fms)\n",
parm->parms[0], kfilelength(h), parm->parms[0], kfilelength(h),
crcval, (double)crctime/timerGetRate(), crcval, crctime,
xxhash, (double)xxhtime/timerGetRate()); xxhash, xxhtime);
kclose(h); kclose(h);