August 18, 2010 [phobos] Proposal of StopWatch module | ||||
---|---|---|---|---|
| ||||
Posted in reply to SHOO | On Wed, Aug 18, 2010 at 3:04 PM, SHOO <zan77137 at nifty.com> wrote: > > 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. > > > I wasn't suggesting you use timeGetTime here :-) But I wanted to bring up the issues for anyone who wasn't aware. And, you mentioned game programming in your original post. Game programmers are hyper-sensitive about this sort of thing, but generally don't actually *need* millisecond accuracy -- just consistency. However, one of the Game Programming Gems books includes a timer implementation that uses QPC, but programmatically takes into account the potential for unexpected values. It would be nice to see a similar solution implemented here. Of course anyone using the StopWatch could implement their own solution to average out the values it returns, if they feel they need to, but having it builtin would be sweet. Just a suggestion. Even if you don't do it, I think this class would be a great addition to Phobos. -- Mike Parker -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20100818/3fadd0c4/attachment.html> |
August 18, 2010 [phobos] Proposal of StopWatch module | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | (2010/08/18 14:24), Jonathan M Davis wrote:
> A suggestion for an enhancement would be to have a separate struct which uses RAII to start and stop the stop watch with that struct taking a delegate/function pointer that runs when the stop watch stops. That way, you get properly matched stops automatically, and you can just get it to automatically do whatever it is you want it to do when it's done - like print out the time elapsed. The result is that you can turn the whole usage of the stop watch into a single line of code. I've done similar stuff with stop watch code that I've written in the past, and I found it to be extremely useful.
>
> - Jonathan M Davis
It's nice.
I try to make some helper struct and functions that are given RAII, but
my trial prevented by dmd's bugs, eg. bug 3516.
I want to make it reservation temporarily.
|
Copyright © 1999-2021 by the D Language Foundation