Re: 'timing' tricks in Win32
- Posted by "Hawke'" <mikedeland at NETZERO.NET> Aug 14, 2000
- 454 views
i could be wrong prolly AM wrong... first glance it looks like you are timing the length of time it takes to load and parse an include file ... i would further submit that this wont be an accurate timer as the disk cache will start skewing results... thats just my guess tho :) --Hawke' ----- Original Message ----- From: wolfgang fritz <wolfritz at KING.IGS.NET> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Monday, August 14, 2000 9:16 PM Subject: 'timing' tricks in Win32 > I've been using the following high-performance counter -include- to more > accurately time things in win32lib programs. ( ..as if that's possible under > multi-tasking ) > The question is, if I do something silly like this: > > include timer.e > get_start() > include win32lib.ew > get_end() > > ...what *exactly*, is it, that I'm timing ? > > Wolf [] > > --start timer.e-- > include dll.e > include machine.e > object myjk > atom myarg, myt1, myt2, myspeed, mydiff > myarg=allocate(4) > constant > mykernel32=open_dll("kernel32.dll"), > myctr=define_c_func( mykernel32,"QueryPerformanceCounter",{C_INT},C_INT), > yfreq=define_c_func( mykernel32,"QueryPerformanceFrequency",{C_INT},C_INT) > myjk=c_func(myfreq,{myarg}) > if myjk = 0 then printf(1,"%s\n",{"sorry, NO COUNTER FOUND !"}) > abort(0) end if > > global procedure get_start() > myjk=c_func(myfreq,{myarg}) > myspeed=peek4u(myarg) > myjk=c_func(myctr,{myarg}) > myt1=peek4u(myarg) > end procedure > > global procedure get_end() > object myhandle > myjk=c_func(myctr,{myarg}) > myt2=peek4u(myarg) > mydiff=myt2-myt1 > myhandle=open("runtime.txt","w") > printf(myhandle,"run time=%f seconds\n\n",{mydiff/myspeed}) > close(myhandle) > free(myarg) > end procedure > --end code-- > ____________NetZero Free Internet Access and Email_________ Download Now http://www.netzero.net/download/index.html Request a CDROM 1-800-333-3633 ___________________________________________________________