[phobos] Proposal of StopWatch module

SHOO zan77137 at nifty.com
Tue Aug 17 23:04:10 PDT 2010


(2010/08/17 23:23), Michael Parker wrote:
> This is great, but there are issues with QueryPerformanceCounter that I
> think ought to be pointed out if you aren't already aware of them. QPC
> is horribly unreliable
> on some chipsets and, on some systems, when running on multiple cores.
> Both issues are decribed in the MS Knowledge Base,
> with the chipset problem at [1] and the multicore problem at [2]. In the
> latter, pay particular attention to point #4 in the Recommendations
> section.
>
> Starting with Vista, QPC will use the newer High Precision Event Timer
> [3], if available (which it should be for most systems running Vista or 7),
> so this becomes less of an issue. But for XP, which is still going to be
> relevant for a few more years at least, this is a big headache. You can
> read more about timing issues in the PDF at [4].
>
> If I were going to use this class in a game, I would expect it to take
> the recommended precautions on XP. Otherwise, I'd just roll my own using
> timeGetTime.
>
> [1] http://support.microsoft.com/kb/274323
> [2] http://msdn.microsoft.com/en-us/library/ee417693.aspx
> [3] http://en.wikipedia.org/wiki/High_Precision_Event_Timer
> [4] (direct PDF link)
> http://algo2.iti.kit.edu/wassenberg/timing/timing_pitfalls.pdf
>
> On Tue, Aug 17, 2010 at 7:43 PM, SHOO <zan77137 at nifty.com
> <mailto:zan77137 at nifty.com>> wrote:
>
>     I made the module of the stopwatch, so I suggest it again here.
>
>     I suggested a time handling module that I called std.time before.
>     Unfortunately itself was not able to contribute to Phobos for the issue
>     of license. But, an important function was included in it. It is what is
>     the StopWatch suggested this time.
>
>     I have some knowledge about machine control engineering. In the field of
>     the machine control engineering, the high accuracy time measurement
>     often plays an important role.
>     For example, the case wants to perform the measurement of the voltage
>     with time by millisecond order for feedback control. When it looks like
>     it, resolution power is not enough by time acquisition such as C's time
>     function in many cases.
>
>     Or the high accuracy time measurement is important in the game
>     programming, too. Or in benchmark testing, too.
>
>     There is std.perf in Phobos as a module with this role now.
>     However, the module is unlisted, and a license doesn't seem to be a
>     Boost license, too.
>     I did not refer Tango at all about this class and examined and made it
>     in my own hand completely.
>
>     Here is the module to suggest this time:
>     http://ideone.com/TVw1P
>
>     # This module is tested by Windows (real) and Ubuntu (virtual PC).
>
>     Please look at it once by all means, and review it.
>     I think that I will commit it at 2010-08-22T15:00Z as far as there is
>     not serious dissenting opinion.
>     _______________________________________________
>     phobos mailing list
>     phobos at puremagic.com <mailto:phobos at puremagic.com>
>     http://lists.puremagic.com/mailman/listinfo/phobos
>
>
>
>
> --
> Mike Parker
>
>
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos

I have some knowledge about these problems.
However, there is not the tool to measure really correct time by Windows.
It means that Windows have a problem about timeGetTime equally.
Ability of timeGetTime is about 10[ms] order. Besides, its accuracy is 
affected by programs to work in background.
In the scene using a highly precise performance counter, the performance 
seems to be insufficiency.

I think the problem that QPC has is the defect of OS and machines.


More information about the phobos mailing list