- All Games: Remove use of timerGetTicks().

This commit is contained in:
Mitchell Richters 2020-08-26 09:30:27 +10:00
parent aba5c4c134
commit 2bf11ad378
7 changed files with 12 additions and 16 deletions

View file

@ -720,10 +720,10 @@ void GameInterface::app_init()
loaddefinitionsfile(BLOODWIDESCREENDEF); loaddefinitionsfile(BLOODWIDESCREENDEF);
const char* defsfile = G_DefFile(); const char* defsfile = G_DefFile();
uint32_t stime = timerGetTicks(); uint32_t stime = I_msTime();
if (!loaddefinitionsfile(defsfile)) if (!loaddefinitionsfile(defsfile))
{ {
uint32_t etime = timerGetTicks(); uint32_t etime = I_msTime();
Printf(PRINT_NONOTIFY, "Definitions file \"%s\" loaded in %d ms.\n", defsfile, etime - stime); Printf(PRINT_NONOTIFY, "Definitions file \"%s\" loaded in %d ms.\n", defsfile, etime - stime);
} }
powerupInit(); powerupInit();

View file

@ -65,8 +65,8 @@ int32_t getatoken(scriptfile *sf, const tokenlist *tl, int32_t ntokens);
void COMMON_clearbackground(int32_t numcols, int32_t numrows); void COMMON_clearbackground(int32_t numcols, int32_t numrows);
// timer defs for profiling function chunks the simple way // timer defs for profiling function chunks the simple way
#define EDUKE32_TMRDEF int32_t t[20], ti=0; const char *tmrstr=__func__; fprintf(stderr,"%s\n",tmrstr); t[ti++]=timerGetTicks(); #define EDUKE32_TMRDEF int32_t t[20], ti=0; const char *tmrstr=__func__; fprintf(stderr,"%s\n",tmrstr); t[ti++]=I_msTime();
#define EDUKE32_TMRTIC t[ti++]=timerGetTicks() #define EDUKE32_TMRTIC t[ti++]=I_msTime()
#define EDUKE32_TMRPRN do { int ii=0; fprintf(stderr,"%s: ",tmrstr); for (ii=1; ii<ti; ii++) fprintf(stderr,"%d ", t[ii]-t[ii-1]); fprintf(stderr,"\n"); } while (0) #define EDUKE32_TMRPRN do { int ii=0; fprintf(stderr,"%s: ",tmrstr); for (ii=1; ii<ti; ii++) fprintf(stderr,"%d ", t[ii]-t[ii-1]); fprintf(stderr,"\n"); } while (0)
#endif #endif

View file

@ -8,6 +8,4 @@
// for compatibility // for compatibility
#define timerUninit() #define timerUninit()
uint32_t timerGetTicks(void);
#endif // timer_h__ #endif // timer_h__

View file

@ -225,7 +225,7 @@ int32_t animvpx_nextpic(animvpx_codec_ctx *codec, uint8_t **picptr)
if (codec->initstate <= 0) // not inited or error if (codec->initstate <= 0) // not inited or error
return 1; return 1;
t[0] = timerGetTicks(); t[0] = I_msTime();
if (codec->decstate == 0) // first time / begin if (codec->decstate == 0) // first time / begin
{ {
@ -289,7 +289,7 @@ read_ivf_frame:
return 5; return 5;
} }
t[1] = timerGetTicks(); t[1] = I_msTime();
uint8_t *const dstpic = codec->pic; uint8_t *const dstpic = codec->pic;
@ -331,7 +331,7 @@ read_ivf_frame:
dstpic[((wy1 + x + 1) << 2) + 2] = v; dstpic[((wy1 + x + 1) << 2) + 2] = v;
} }
} }
t[2] = timerGetTicks(); t[2] = I_msTime();
codec->sumtimes[0] += t[1]-t[0]; codec->sumtimes[0] += t[1]-t[0];
codec->sumtimes[1] += t[2]-t[1]; codec->sumtimes[1] += t[2]-t[1];
@ -369,7 +369,7 @@ void animvpx_restore_glstate(void)
int32_t animvpx_render_frame(animvpx_codec_ctx *codec, double animvpx_aspect) int32_t animvpx_render_frame(animvpx_codec_ctx *codec, double animvpx_aspect)
{ {
int32_t t = timerGetTicks(); int32_t t = I_msTime();
if (codec->initstate <= 0) // not inited or error if (codec->initstate <= 0) // not inited or error
return 1; return 1;
@ -404,7 +404,7 @@ int32_t animvpx_render_frame(animvpx_codec_ctx *codec, double animvpx_aspect)
DrawTexture(twod, vpxtex[which], screen->GetWidth() / 2 - int(x), screen->GetHeight()/2 - int(y), DTA_DestWidth, 2*int(x), DTA_DestHeight, 2*int(y), DrawTexture(twod, vpxtex[which], screen->GetWidth() / 2 - int(x), screen->GetHeight()/2 - int(y), DTA_DestWidth, 2*int(x), DTA_DestHeight, 2*int(y),
DTA_Masked, false, DTA_KeepRatio, true, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE); DTA_Masked, false, DTA_KeepRatio, true, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
t = timerGetTicks()-t; t = I_msTime()-t;
codec->sumtimes[2] += t; codec->sumtimes[2] += t;
codec->maxtimes[2] = max(codec->maxtimes[2], t); codec->maxtimes[2] = max(codec->maxtimes[2], t);
codec->numframes++; codec->numframes++;

View file

@ -2726,7 +2726,7 @@ void videoNextPage(void)
videoShowFrame(0); videoShowFrame(0);
omdtims = mdtims; omdtims = mdtims;
mdtims = timerGetTicks(); mdtims = I_msTime();
for (native_t i = 0; i < MAXSPRITES + MAXUNIQHUDID; ++i) for (native_t i = 0; i < MAXSPRITES + MAXUNIQHUDID; ++i)
if ((mdpause && spriteext[i].mdanimtims) || (spriteext[i].flags & SPREXT_NOMDANIM)) if ((mdpause && spriteext[i].mdanimtims) || (spriteext[i].flags & SPREXT_NOMDANIM))

View file

@ -14,5 +14,3 @@ EDUKE32_STATIC_ASSERT((steady_clock::period::den/steady_clock::period::num) >= 1
static time_point<steady_clock> timerlastsample; static time_point<steady_clock> timerlastsample;
static int timerticspersec; static int timerticspersec;
uint32_t timerGetTicks(void) { return duration_cast<milliseconds>(steady_clock::now().time_since_epoch()).count(); }

View file

@ -624,10 +624,10 @@ void GameInterface::app_init()
InstallEngine(); InstallEngine();
const char* defsfile = G_DefFile(); const char* defsfile = G_DefFile();
uint32_t stime = timerGetTicks(); uint32_t stime = I_msTime();
if (!loaddefinitionsfile(defsfile)) if (!loaddefinitionsfile(defsfile))
{ {
uint32_t etime = timerGetTicks(); uint32_t etime = I_msTime();
Printf("Definitions file \"%s\" loaded in %d ms.\n", defsfile, etime - stime); Printf("Definitions file \"%s\" loaded in %d ms.\n", defsfile, etime - stime);
} }