Timers - multi media vs query performance counter

Discussion in 'Tools and Software' started by willow, May 6, 2008.

  1. willow

    Newcomer

    Joined:
    May 6, 2008
    Messages:
    3
    Hi all from a newbie

    Wonder if you guys can help with the following ?

    We are working on a plugin to pull real time telemetry information out of racing games, such as rFactor, GTR2 etc etc. As you may or may not know, rfactor (ISI) are very helpful in this respect providing a whole host of information. We need to pull the right data out of the game as quickly as possible and have been working on this for some time.

    We can pull the data out, no problem, the current issue we have is around timers. We must be able to run our software without it impacting frame rate significantly. Our current route has been to use MS multimedia timer - however we are consistently seeing a 20% reduction in frame rates when running the game with our software.

    We have considered queryPerformance Counter but really are not sure of the pro's and con's vs MS Mmt.

    Because we want as much information to be pulled from the game software as possible in real time, we need a timing solution that will allow us to pull data at 300/ 400 times a second but with minimal/ no impact to frame rate.

    Any experience of this area - specifically what is the best option and why - would be very much appreciated.

    Thanks all
     
  2. sebbbi

    Veteran

    Joined:
    Nov 14, 2007
    Messages:
    2,188
    Location:
    Helsinki, Finland
    Windows multimedia timer timeGetTime() has pretty good precision if you are using timeBeginPeriod() and timeEndPeriod() to change the timer resolution to 1 ms. It's also the most safe way to time your application.

    QueryPerformanceCounter() and QueryPerformanceFrequency() offer a bit better resolution, but have different issues. For example in Windows XP, all AMD Athlon X2 dual core CPUs return the PC of either of the cores "randomly" (the PC sometimes jumps a bit backwards), unless you specially install AMD dual core driver package to fix the issue. We haven't noticed any other dual+ core CPUs having similar issues (p4 dual, p4 ht, core2 dual, core2 quad, phenom quad).

    Some links I quickly googled:
    http://www.mindcontrol.org/~hplus/pc-timers.html
    http://www.virtualdub.org/blog/pivot/entry.php?id=106
     
  3. Davros

    Legend

    Joined:
    Jun 7, 2004
    Messages:
    12,925
    doesnt the DataAcquisitionPlugin.dll do it for you ?
     
  4. willow

    Newcomer

    Joined:
    May 6, 2008
    Messages:
    3
    Thanks for the quick responses! Useful and informative links.
    re: DataAcquisitionPlugin.dll
    yes, this gives us a usable time interval for rFactor, but we're really looking for a more general solution, that will work for other games too, and we currently get a slower frame rate in the game when using QueryPerformanceCounter or the other timers in our outboard application.

    Are there known issues with these precision timers running outside DirectX games, affecting the game? Any links would be very helpful, thankyou
     
  5. Tokelil

    Regular

    Joined:
    Mar 27, 2002
    Messages:
    329
    Location:
    Denmark
    This might be a stupid question, but if you see a 20% drop in fps with the timing functions, what are the framerate drop leaving them out but keeping the rest of the log logic? I wouldn't have thought either would impact performance much, compared to "real work".
     
  6. willow

    Newcomer

    Joined:
    May 6, 2008
    Messages:
    3
    Hi guys ..... Are there known issues with these precision timers running outside DirectX games, affecting the game? Any links would be very helpful, thankyou
     

Share This Page

  • About Beyond3D

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...