choppy framerate on dual cpu systems

Hi all!
I beg your pardon if this has been asked before, but I was not able to find a similar topic in the knowledge base :frowning:

I have a very simple (ie mono-threaded) fullscreen OpenGL app. It works fine on many configurations, but on some dual cpu systems framerate becomes really “choppy”, ie it continually changes between, say, 5fps and 200fps! Of course, the result is really bad (the animation is not very smooth, as you may imagine)…

I dunno what could be the problem. It shouldn’t be a problem with timers because I use timeGetTime (I read that performance timers CAN give problems on multi cpus boxs, but timeGetTime should be safe enough); I’ve also tried to force my mono-threaded app to stay on just one CPU by setting the affinity mask (just in case), but it didn’t help.

The problem seems to become worse with bigger textures and when using FBOs (but even with direct rendering to the “traditional” framebuffer it’s still present). It doesn’t happen on EVERY multi cpu box, but it happens on both nVidia AND Ati equipped hardware; sometimes, on nVidia, turning off the “optimize for multi-threaded apps” option from the nVidia control panel cures the problem, but sometimes it’s still there…

Has anybody any clue about what could be the cause? Thank to everybody in advance for your time…

Prefer QueryPerformanceFrequency/Counter on Windows going forward.

First of all, thank you very much for the quick answer and for the hint! Alas, from what I know performance timers are even more prone to problems on multi-cpu systems… Anyway, this shouldn’t be the problem because I force the whole process to stay on just one CPU (SetProcessAffinityMask), maybe the problem is elsewhere…?

Try turning off “threaded optimization” in the driver settings, if you are using a Nvidia card.

This “optimization” always causes your mentioned irregular timing problems for me.

Yes, but if you read my previous post, this doesn’t always solve the problem; moreover, I get the same very problem on ATi cards, so I think that the cause should be elsewhere…

Are you trying to limit the framerate yourself (with some loop)? Or that timeGetTime is just to measure FPS?

Shader recompilation can cause such performance drops.

Depending on motherboard, BIOS and CPU (older dual core CPU & mobos), performance counter is not synced between two cores. So… in first loop one core execute code… then a bit later second core execute next loop. Because performace counters is not synced between cores, it can produce negative delta time between frames. If your physx calculations and animation depends on delta time then gameplay falls apart.

Solution is to stick to one core (set process affinity) or install some updates from AMD (dual core optimizer or such) or Mocrosoft (some KBxxxxxx fix) site.