In Windows and SDL layers, rename *hitick* to *u64tick*.

git-svn-id: https://svn.eduke32.com/eduke32@3934 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-07-07 20:59:00 +00:00
parent f37d845f02
commit 76a04c4a3a
6 changed files with 31 additions and 30 deletions

View file

@ -148,8 +148,8 @@ void uninittimer(void);
void sampletimer(void); void sampletimer(void);
uint32_t getticks(void); uint32_t getticks(void);
int32_t gettimerfreq(void); int32_t gettimerfreq(void);
uint64_t gethiticks(void); uint64_t getu64ticks(void);
uint64_t gethitickspersec(void); uint64_t getu64tickspersec(void);
double gethitickms(void); // TODO: Windows double gethitickms(void); // TODO: Windows
void (*installusertimercallback(void (*callback)(void)))(void); void (*installusertimercallback(void (*callback)(void)))(void);

View file

@ -15,7 +15,7 @@ extern void win_allowtaskswitching(int32_t onf);
extern int32_t win_checkinstance(void); extern int32_t win_checkinstance(void);
extern int32_t win_inittimer(void); extern int32_t win_inittimer(void);
extern uint64_t win_gethiticks(void); extern uint64_t win_getu64ticks(void);
extern void win_open(void); extern void win_open(void);
extern void win_init(void); extern void win_init(void);

View file

@ -258,7 +258,8 @@ int32_t autogray = 0, showinnergray = 1;
//#define YAX_DEBUG_YMOSTS //#define YAX_DEBUG_YMOSTS
#ifdef YAX_DEBUG #ifdef YAX_DEBUG
double hitickspersec; // XXX: This could be replaced with the use of gethitickms().
double u64tickspersec;
#endif #endif
#ifdef ENGINE_SCREENSHOT_DEBUG #ifdef ENGINE_SCREENSHOT_DEBUG
int32_t engine_screenshot = 0; int32_t engine_screenshot = 0;
@ -1019,7 +1020,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t),
j = bunches[cf][bnchcnt]; // the actual bunchnum... j = bunches[cf][bnchcnt]; // the actual bunchnum...
yax_globalbunch = j; yax_globalbunch = j;
#ifdef YAX_DEBUG #ifdef YAX_DEBUG
t=gethiticks(); t=getu64ticks();
#endif #endif
k = bunchsec[j]; k = bunchsec[j];
@ -1043,7 +1044,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t),
yaxdebug("l%d: faked (bn %2d) sec %4d,%3d dspr, ob=[%2d,%2d], sn=%4d, %.3f ms", yaxdebug("l%d: faked (bn %2d) sec %4d,%3d dspr, ob=[%2d,%2d], sn=%4d, %.3f ms",
yax_globallev-YAX_MAXDRAWS, j, k, yax_spritesortcnt[yax_globallev]-odsprcnt, yax_globallev-YAX_MAXDRAWS, j, k, yax_spritesortcnt[yax_globallev]-odsprcnt,
ourbunch[0],ourbunch[1],sectnum, ourbunch[0],ourbunch[1],sectnum,
(double)(1000*(gethiticks()-t))/hitickspersec); (double)(1000*(getu64ticks()-t))/u64tickspersec);
} }
if (ourbunch[cf]==j) if (ourbunch[cf]==j)
@ -1103,7 +1104,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t),
k = bunchsec[j]; // best start-drawing sector k = bunchsec[j]; // best start-drawing sector
yax_globalbunch = j; yax_globalbunch = j;
#ifdef YAX_DEBUG #ifdef YAX_DEBUG
t=gethiticks(); t=getu64ticks();
#endif #endif
yax_tweakpicnums(j, cf, 0); yax_tweakpicnums(j, cf, 0);
if (k < 0) if (k < 0)
@ -1119,7 +1120,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t),
{ {
yaxdebug("nm1 l%d: DRAWN (bn %2d) sec %4d, %.3f ms", yaxdebug("nm1 l%d: DRAWN (bn %2d) sec %4d, %.3f ms",
yax_globallev-YAX_MAXDRAWS, j, k, yax_globallev-YAX_MAXDRAWS, j, k,
(double)(1000*(gethiticks()-t))/hitickspersec); (double)(1000*(getu64ticks()-t))/u64tickspersec);
if (!yax_nomaskdidit) if (!yax_nomaskdidit)
{ {
@ -1135,7 +1136,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t),
yax_copytsprites(); yax_copytsprites();
yaxdebug("nm0 l%d: DRAWN (bn %2d) sec %4d,%3d tspr, %.3f ms", yaxdebug("nm0 l%d: DRAWN (bn %2d) sec %4d,%3d tspr, %.3f ms",
yax_globallev-YAX_MAXDRAWS, j, k, spritesortcnt, yax_globallev-YAX_MAXDRAWS, j, k, spritesortcnt,
(double)(1000*(gethiticks()-t))/hitickspersec); (double)(1000*(getu64ticks()-t))/u64tickspersec);
SpriteAnimFunc(globalposx, globalposy, globalang, smoothr); SpriteAnimFunc(globalposx, globalposy, globalang, smoothr);
drawmasks(); drawmasks();
@ -1148,7 +1149,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t),
} }
#ifdef YAX_DEBUG #ifdef YAX_DEBUG
t=gethiticks(); t=getu64ticks();
#endif #endif
yax_globalcf = -1; yax_globalcf = -1;
yax_globalbunch = -1; yax_globalbunch = -1;
@ -1162,7 +1163,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t),
// spritesortcnt = 0; // spritesortcnt = 0;
yax_copytsprites(); yax_copytsprites();
yaxdebug("DRAWN base level sec %d,%3d tspr, %.3f ms", osectnum, yaxdebug("DRAWN base level sec %d,%3d tspr, %.3f ms", osectnum,
spritesortcnt, (double)(1000*(gethiticks()-t))/hitickspersec); spritesortcnt, (double)(1000*(getu64ticks()-t))/u64tickspersec);
scansector_collectsprites = 1; scansector_collectsprites = 1;
for (cf=0; cf<2; cf++) for (cf=0; cf<2; cf++)
@ -8635,9 +8636,9 @@ int32_t initengine(void)
} }
#ifdef YAX_DEBUG #ifdef YAX_DEBUG
hitickspersec = (double)gethitickspersec(); u64tickspersec = (double)getu64tickspersec();
if (hitickspersec==0.0) if (u64tickspersec==0.0)
hitickspersec = 1.0; u64tickspersec = 1.0;
#endif #endif
if (loadtables()) if (loadtables())

View file

@ -795,7 +795,7 @@ void releaseallbuttons(void)
static Uint32 timerfreq=0; static Uint32 timerfreq=0;
static Uint32 timerlastsample=0; static Uint32 timerlastsample=0;
int32_t timerticspersec=0; int32_t timerticspersec=0;
static double msperhitick = 0; static double msperu64tick = 0;
static void(*usertimercallback)(void) = NULL; static void(*usertimercallback)(void) = NULL;
@ -822,7 +822,7 @@ int32_t inittimer(int32_t tickspersecond)
usertimercallback = NULL; usertimercallback = NULL;
msperhitick = 1000.0 / (double)gethitickspersec(); msperu64tick = 1000.0 / (double)getu64tickspersec();
return 0; return 0;
} }
@ -840,7 +840,7 @@ void uninittimer(void)
win_timerfreq=0; win_timerfreq=0;
#endif #endif
msperhitick = 0; msperu64tick = 0;
} }
// //
@ -872,11 +872,11 @@ uint32_t getticks(void)
} }
// high-resolution timers for profiling // high-resolution timers for profiling
uint64_t gethiticks(void) uint64_t getu64ticks(void)
{ {
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2 #if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2
# if defined _WIN32 # if defined _WIN32
return win_gethiticks(); return win_getu64ticks();
# elif defined __APPLE__ # elif defined __APPLE__
return mach_absolute_time(); return mach_absolute_time();
# elif _POSIX_TIMERS>0 && defined _POSIX_MONOTONIC_CLOCK # elif _POSIX_TIMERS>0 && defined _POSIX_MONOTONIC_CLOCK
@ -895,7 +895,7 @@ uint64_t gethiticks(void)
# else # else
// Blar. This pragma is unsupported on earlier GCC versions. // Blar. This pragma is unsupported on earlier GCC versions.
// At least we'll get a warning and a reference to this line... // At least we'll get a warning and a reference to this line...
# pragma message "Using low-resolution (1ms) timer for gethiticks. Profiling will work badly." # pragma message "Using low-resolution (1ms) timer for getu64ticks. Profiling will work badly."
return SDL_GetTicks(); return SDL_GetTicks();
# endif # endif
#else #else
@ -903,7 +903,7 @@ uint64_t gethiticks(void)
#endif #endif
} }
uint64_t gethitickspersec(void) uint64_t getu64tickspersec(void)
{ {
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2 #if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2
# if defined _WIN32 # if defined _WIN32
@ -930,7 +930,7 @@ uint64_t gethitickspersec(void)
ATTRIBUTE((flatten)) ATTRIBUTE((flatten))
double gethitickms(void) double gethitickms(void)
{ {
return (double)gethiticks() * msperhitick; return (double)getu64ticks() * msperu64tick;
} }
// //

View file

@ -153,7 +153,7 @@ int32_t win_inittimer(void)
return 0; return 0;
} }
uint64_t win_gethiticks(void) uint64_t win_getu64ticks(void)
{ {
uint64_t i; uint64_t i;
if (win_timerfreq == 0) return 0; if (win_timerfreq == 0) return 0;

View file

@ -1429,7 +1429,7 @@ static const char *GetDInputError(HRESULT code)
static int32_t timerlastsample=0; static int32_t timerlastsample=0;
int32_t timerticspersec=0; int32_t timerticspersec=0;
static double msperhitick = 0; static double msperu64tick = 0;
static void (*usertimercallback)(void) = NULL; static void (*usertimercallback)(void) = NULL;
// This timer stuff is all Ken's idea. // This timer stuff is all Ken's idea.
@ -1469,7 +1469,7 @@ int32_t inittimer(int32_t tickspersecond)
usertimercallback = NULL; usertimercallback = NULL;
msperhitick = 1000.0 / (double)gethitickspersec(); msperu64tick = 1000.0 / (double)getu64tickspersec();
return 0; return 0;
} }
@ -1484,7 +1484,7 @@ void uninittimer(void)
win_timerfreq=0; win_timerfreq=0;
timerticspersec = 0; timerticspersec = 0;
msperhitick = 0; msperu64tick = 0;
} }
// //
@ -1521,12 +1521,12 @@ uint32_t getticks(void)
} }
// high-resolution timers for profiling // high-resolution timers for profiling
uint64_t gethiticks(void) uint64_t getu64ticks(void)
{ {
return win_gethiticks(); return win_getu64ticks();
} }
uint64_t gethitickspersec(void) uint64_t getu64tickspersec(void)
{ {
return win_timerfreq; return win_timerfreq;
} }
@ -1535,7 +1535,7 @@ uint64_t gethitickspersec(void)
ATTRIBUTE((flatten)) ATTRIBUTE((flatten))
double gethitickms(void) double gethitickms(void)
{ {
return (double)gethiticks() * msperhitick; return (double)getu64ticks() * msperu64tick;
} }
// //