Rename the external 'gethitickms()' to 'gethiticks()'.

git-svn-id: https://svn.eduke32.com/eduke32@3935 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-07-07 20:59:05 +00:00
parent 76a04c4a3a
commit f506e0f570
16 changed files with 52 additions and 52 deletions

View file

@ -150,7 +150,7 @@ uint32_t getticks(void);
int32_t gettimerfreq(void);
uint64_t getu64ticks(void);
uint64_t getu64tickspersec(void);
double gethitickms(void); // TODO: Windows
double gethiticks(void);
void (*installusertimercallback(void (*callback)(void)))(void);
int32_t checkvideomode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t forced);

View file

@ -258,7 +258,7 @@ int32_t autogray = 0, showinnergray = 1;
//#define YAX_DEBUG_YMOSTS
#ifdef YAX_DEBUG
// XXX: This could be replaced with the use of gethitickms().
// XXX: This could be replaced with the use of gethiticks().
double u64tickspersec;
#endif
#ifdef ENGINE_SCREENSHOT_DEBUG

View file

@ -928,7 +928,7 @@ uint64_t getu64tickspersec(void)
// Returns the time since an unspecified starting time in milliseconds.
// (May be not monotonic for certain configurations.)
ATTRIBUTE((flatten))
double gethitickms(void)
double gethiticks(void)
{
return (double)getu64ticks() * msperu64tick;
}

View file

@ -1533,7 +1533,7 @@ uint64_t getu64tickspersec(void)
// Returns the time since an unspecified starting time in milliseconds.
ATTRIBUTE((flatten))
double gethitickms(void)
double gethiticks(void)
{
return (double)getu64ticks() * msperu64tick;
}

View file

@ -374,7 +374,7 @@ static struct {
int32_t numtics, numframes;
double totalgamems;
double totalroomsdrawms, totalrestdrawms;
double starthitickms;
double starthiticks;
} g_prof;
int32_t Demo_IsProfiling(void)
@ -390,14 +390,14 @@ static void Demo_StopProfiling(void)
static void Demo_GToc(double t)
{
g_prof.numtics++;
g_prof.totalgamems += gethitickms()-t;
g_prof.totalgamems += gethiticks()-t;
}
static void Demo_RToc(double t1, double t2)
{
g_prof.numframes++;
g_prof.totalroomsdrawms += t2-t1;
g_prof.totalrestdrawms += gethitickms()-t2;
g_prof.totalrestdrawms += gethiticks()-t2;
}
static void Demo_DisplayProfStatus(void)
@ -427,7 +427,7 @@ static void Demo_SetupProfile(void)
Bmemset(&g_prof, 0, sizeof(g_prof));
g_prof.starthitickms = gethitickms();
g_prof.starthiticks = gethiticks();
}
static void Demo_FinishProfile(void)
@ -459,7 +459,7 @@ static void Demo_FinishProfile(void)
{
double totalprofms = gms+dms1+dms2;
double totalms = gethitickms()-g_prof.starthitickms;
double totalms = gethiticks()-g_prof.starthiticks;
if (totalprofms != 0)
OSD_Printf("== demo %d: non-profiled time overhead: %.02f %%\n",
dn, 100.0*totalms/totalprofms - 100.0);
@ -726,7 +726,7 @@ nextdemo_nomenu:
if (Demo_IsProfiling())
{
double t = gethitickms();
double t = gethiticks();
G_DoMoveThings();
Demo_GToc(t);
}
@ -807,7 +807,7 @@ nextdemo_nomenu:
for (i=0; i<num; i++)
{
double t1 = gethitickms(), t2;
double t1 = gethiticks(), t2;
// initprintf("t=%d, o=%d, t-o = %d\n", totalclock,
// ototalclock, totalclock-ototalclock);
@ -820,7 +820,7 @@ nextdemo_nomenu:
G_DrawRooms(screenpeek,j);
t2 = gethitickms();
t2 = gethiticks();
G_DisplayRest(j);

View file

@ -119,14 +119,14 @@ static void VM_KillIt(int32_t iActor, int32_t iPlayer)
int32_t VM_OnEvent(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t lDist, int32_t iReturn)
{
#ifdef LUNATIC
const double t = gethitickms();
const double t = gethiticks();
// TODO: handling of RETURN gamevar / iReturn / this function's return value
if (L_IsInitialized(&g_ElState) && El_HaveEvent(iEventID))
if (El_CallEvent(&g_ElState, iEventID, iActor, iPlayer, lDist, &iReturn)==1)
VM_KillIt(iActor, iPlayer);
g_eventTotalMs[iEventID] += gethitickms()-t;
g_eventTotalMs[iEventID] += gethiticks()-t;
g_eventCalls[iEventID]++;
#else
@ -5399,13 +5399,13 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
#ifdef LUNATIC
{
double t = gethitickms();
double t = gethiticks();
const int32_t picnum = vm.g_sp->picnum;
if (L_IsInitialized(&g_ElState) && El_HaveActor(picnum))
killit = (El_CallActor(&g_ElState, picnum, iActor, iPlayer, lDist)==1);
t = gethitickms()-t;
t = gethiticks()-t;
g_actorTotalMs[picnum] += t;
g_actorMinMs[picnum] = min(g_actorMinMs[picnum], t);
g_actorMaxMs[picnum] = max(g_actorMaxMs[picnum], t);

View file

@ -1536,7 +1536,7 @@ local allowed_modules = {
coroutine=coroutine, bit=bit, table=table, math=math, string=string,
os = {
clock = function() return gv_.gethitickms()*0.001 end,
clock = function() return gv_.gethiticks()*0.001 end,
},
randgen = randgen,

View file

@ -443,7 +443,7 @@ void setaspect(int32_t daxrange, int32_t daaspect);
-- misc. functions
ffi.cdef[[
uint32_t getticks(void);
double gethitickms(void);
double gethiticks(void);
int32_t krand(void);
int32_t ksqrt(uint32_t num);

View file

@ -323,12 +323,12 @@ Returns one value from the global engine-side pseudo-random number generator
in the integer range [0{nbsp}..{nbsp}65535].
[[timing_funcs]]
`gv.getticks()`, `gv.gethitickms()`::
`gv.getticks()`, `gv.gethiticks()`::
Each of these functions return a number that increases at a rate of 1 per
millisecond. Their only intended application is to profile bits of code; they
should not be used to control the game world. The two functions differ in their
precision: `getticks()` always returns integral values, while the result of
`gethitickms()` also has an unspecified precision in the fractional part. (It
`gethiticks()` also has an unspecified precision in the fractional part. (It
can be expected to give a time precision of at least one microsecond.)
`gv.doQuake(gametics [, snd])`::

View file

@ -80,7 +80,7 @@ updatesectorz;
updatesectorbreadth;
getticks;
gethitickms;
gethiticks;
OSD_Printf;
crc32once;

View file

@ -80,7 +80,7 @@ updatesectorz;
updatesectorbreadth;
getticks;
gethitickms;
gethiticks;
OSD_Printf;
crc32once;

View file

@ -63,14 +63,14 @@ function compinside(n)
local isi, iss = {}, {}
for i=1,n do
local t = ffiC.gethitickms()
local t = ffiC.gethiticks()
isi[i] = inside(posns[i], sects[i])
t = ffiC.gethitickms()-t
t = ffiC.gethiticks()-t
sti:add(t)
local t = ffiC.gethitickms()
local t = ffiC.gethiticks()
iss[i] = sector[sects[i]]:contains(posns[i])
t = ffiC.gethitickms()-t
t = ffiC.gethiticks()-t
sts:add(t)
-- if (isi[i]~=iss[i]) then

View file

@ -59,9 +59,9 @@ function randwalk(N, spritenum, minlen, maxlen, randofs, funci, logfn)
--]]
local newpos = pos + xmath.ivec3(ax,ay,az)
local t = ffiC.gethitickms()
local t = ffiC.gethiticks()
local newsect = updatesectorfunc(newpos, sectnum)
t = ffiC.gethitickms()-t
t = ffiC.gethiticks()-t
st.all:add(t)
times[i] = t

View file

@ -31,8 +31,8 @@ uint32_t crc32once(uint8_t *blk, uint32_t len);
]]
local function get_rand_u32(tin)
tin.d[0] = ffiC.gethitickms() % 1
tin.d[1] = ffiC.gethitickms() % 1
tin.d[0] = ffiC.gethiticks() % 1
tin.d[1] = ffiC.gethiticks() % 1
return ffiC.crc32once(tin.u, 16)
end
@ -79,11 +79,11 @@ function new(x,y,z,c)
local r=ffi.new("rng_jkiss_t")
r.x = 123456789; r.y = 987654321; r.z = 43219876; r.c = 6543217;
t=gv.gethitickms()
t=gv.gethiticks()
for i=1,4*2*1e6 do
ffiC.rand_jkiss_dbl(r)
end
print("TIME: "..gv.gethitickms()-t) -- x86_64: approx. 100 ms
print("TIME: "..gv.gethiticks()-t) -- x86_64: approx. 100 ms
--]]
return s

View file

@ -170,7 +170,7 @@ print('')
checkfail('gv.luaJIT_setmode(nil, 0, 0)', "missing declaration for symbol 'luaJIT_setmode'")
checkfail('gv.luaJIT_BC_con_lang', "attempt to call a nil value")
checkfail('gv.gethitickms = nil', "attempt to write to constant location")
checkfail('gv.gethiticks = nil', "attempt to write to constant location")
-- actor[].t_data[] is not accessible for now
checkfail('local i = actor[0].t_data[15]', "has no member named 't_data'")
@ -270,31 +270,31 @@ gameevent
-- NOTE: times are for helixhorned (Core2Duo 3GHz)
local i
local N = 1e6
local t = gv.gethitickms()
local t = gv.gethiticks()
for i=3,N do
gv.gethitickms()
gv.gethiticks()
end
t = gv.gethitickms()-t
t = gv.gethiticks()-t
-- x86_64: 35ns/call, x86: 280 ns/call
-- Windows 32-bit: about 1 us/call?
printf("%d gethitickms() calls took %.03f ms (%.03f us/call)",
printf("%d gethiticks() calls took %.03f ms (%.03f us/call)",
N, t, (t*1000)/N)
local sum=0
t = gv.gethitickms()
t = gv.gethiticks()
for i=1,N do sum = sum+gv.ksqrt(i) end
t = gv.gethitickms()-t
t = gv.gethiticks()-t
-- x86_64: 14ns/call
printf("%d ksqrt() calls took %.03f ms (%.03f us/call) [sum=%f]",
N, t, (t*1000)/N, sum)
sum=0
t = gv.gethitickms()
t = gv.gethiticks()
for i=1,N do sum = sum+math.sqrt(i) end
t = gv.gethitickms()-t
t = gv.gethiticks()-t
-- x86_64: 7ns/call
printf("%d math.sqrt() calls took %.03f ms (%.03f us/call) [sum=%f]",
N, t, (t*1000)/N, sum)
@ -318,7 +318,7 @@ gameevent
proj.drop = 0
proj:set_trail(D.SMALLSMOKE)
t = gv.gethitickms()
t = gv.gethiticks()
local N=1
for n=1,N do
for i=0,gv.MAXSPRITES-1 do
@ -334,7 +334,7 @@ gameevent
sprite[i].yoffset = 1
end
end
t = gv.gethitickms()-t
t = gv.gethiticks()-t
printf("%d x four 0..MAXSPRITES-1 iterations took %.03f us per outer iteration", N, (1000*t)/N)
-- Results on x86:
-- N=1: 480-1000 us (too large variance)
@ -425,10 +425,10 @@ gameactor
local spr = sprite[i]
local t = gv.gethitickms()
local t = gv.gethiticks()
local hit = hitscan(spr, spr.sectnum, 10, 10, 0, gv.CLIPMASK0)
hs:add(1000*(gv.gethitickms()-t))
hs:add(1000*(gv.gethiticks()-t))
if (hs.n == 300) then
printf("hitscan: %s", hs:getstatstr())
@ -635,20 +635,20 @@ do
local sum = 0
local N = 1000
local t = gv.gethitickms()
local t = gv.gethiticks()
for i=0,N*2048-1 do
sum = sum+xmath.ksin(i)
end
t = gv.gethitickms()-t
t = gv.gethiticks()-t
sum = sum*1e12
printf("ksin: sum*1e12=%.03f, %.03fus per 0-2047 cycle", sum, t)
sum = 0
local t = gv.gethitickms()
local t = gv.gethiticks()
for i=0,N*2048-1 do
sum = sum+xmath.sinb(i)
end
t = gv.gethitickms()-t
t = gv.gethiticks()-t
sum = sum*1e12
printf("sinb: sum*1e12=%.03f, %.03fus per 0-2047 cycle", sum, t)
@ -660,7 +660,7 @@ end
do
-- Test getflorzofslopeptr()/sector[]:floorzat()
local N = 100
local t = gv.gethitickms()
local t = gv.gethiticks()
for n=1,N do
for i=0,gv.numsectors-1 do
@ -670,7 +670,7 @@ do
end
end
printf("%d x %d floorzat: %.03f us", N, gv.numsectors, (gv.gethitickms()-t)*1000)
printf("%d x %d floorzat: %.03f us", N, gv.numsectors, (gv.gethiticks()-t)*1000)
-- Results for 100 x 325 floorzat (helixhorned x86):
-- cdecl getflorzofslope(): 572.165 us

View file

@ -20,7 +20,7 @@ if (string.dump) then
end
else
-- embedded
getticks = gv.gethitickms
getticks = gv.gethiticks
module(...)
end