lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> I was wondering what is wrong with function GetTickCount. I have not
tested
> it thoroughly, but it seems to be working fine.
> 
> []s,
> Diego.

Thanks for bringing back this topic under a distinctive title :-) I had
something to add.

Nothing wrong, it seems not very much used because of the low resolution of
the involved timer, ie. as given previously:
Windows NT 3.5 and later: The system timer runs at approximately 10ms. 
Windows NT 3.1: The system timer runs at approximately 16ms. 
Windows 95/98/Me: The system timer runs at approximately 55ms.

People prefer to use multimedia timer or the high-resolution timer, or even
the RDTSC Pentium instruction for those very picky.
The high-resolution timer seems sufficient in most cases, while still having
clock() as a backup solution.

Ironic node: excerpt from MSDN: "Note that the system can periodically
refresh the time by synchronizing with a time source. Because the system time can
be adjusted either forward or backward, do not compare system time readings
[PL note: eg. using GetSystemTimeAsFileTime] to determine elapsed time."
clock() is based on GetSystemTimeAsFileTime() and most of its uses are for
measuring elapsed time... Oh well.

I found on the Net a code snippet mentioning the GetProcessTimes() function.
It seems to work a bit like times(). It returns, among other things, kernel
and user time spent by the process. This exactly what I was looking for...
except the above mentioned code snippet indicated that the values returned were
unreliable, as the counter may no be updated for some time... And it used
instead the high-resolution timer. (From http://www.tltools.org/).
BTW, it is for NT familly only. There is also a GetThreadTimes() function.

Perhaps I will give a shot anyway, to make my mind. I have found no other
reference to the unreliability of this function.

Regards.

-- 
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--

GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net