counter test

new topic     » topic index » view thread      » older message » newer message

Here's a little 'Windows ( use exw.exe )' program that attempts to access the
high performance counter on your 'puter,  ... *if* it has one.
I'd appreciate any results, *especially* if your 'puter doesn't have this
counter,
directly to:
wolfritz at king.igs.net
...thanks, Wolf

-- checkit.exw --

include machine.e
include dll.e

atom stop
object jk
atom arg, t1, t2, speed, diff
arg=allocate(4)
constant
kernel32=open_dll("kernel32.dll"),
ctr=define_c_func( kernel32,"QueryPerformanceCounter",{C_INT},C_INT),
freq=define_c_func( kernel32,"QueryPerformanceFrequency",{C_INT},C_INT)
jk=c_func(freq,{arg})
if jk = 0 then
printf(1,"%s\n",{"NO COUNTER FOUND !"})
else
speed=peek4u(arg)
printf(1,"frequency=%.0f counts/per/sec.\n",{speed})
printf(1,"resolution=%.14f seconds\n",{1/speed})
jk=c_func(ctr,{arg})
t1=peek4u(arg)
jk=c_func(ctr,{arg})
t2=peek4u(arg)
diff=t2-t1
printf(1,"ticks=%d\n",{diff})
printf(1,"function call time=%.14f seconds\n\n",{diff/speed})
end if
-- end code --

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu