Strange framerate changes

Started by
8 comments, last by Empirical 19 years, 7 months ago
So I decided to take a look at the framerate of a little game I'm developing in release mode. Everything was fine, it was around 96-98 fps (it doesn't go above 100 - my monitor refresh rate). Then, after awhile, the framerate dropped to between 42-44 fps. The strange thing is, after about 8 minutes, it goes back up to 96-98 fps. Then again, after about 2.5 minutes, back to 42-44 fps. I waited around for about two more times and it was quite consistent i.e. it takea about 8 minutes for framerate to suddenly go up to 90's and 2.5 mins to suddenly drop to 40's. If it's in the 40's, even if I exit my program and run it again, it'll still be in the 40's. I'm hoping someone may have encountered something similar to this before and could give me some suggestions as to what it may be. I've read in another thread about how Windows might start doing some work if my game is sitting around doing nothing. Maybe that's it. Any advice would be much appreciated as I'm quite perplexed by this. Thanks. I forgot to add the second part of my problem. Not sure if this is an entirely separate problem or if it has something to do with the first problem. For the first problem, I was running the release mode within Visual Studios 7. However, if I run my program outside i.e. just straight from Windows, then I get < 1 fps! Sometime like 0.2 fps. What is it doing? And what do I need to do to make it stop? Thanks again.
........................Leo LeeSoftware Engineerhttp://www.leolees.com
Advertisement
Is it a C++ ap?

It could be Windows I guess, though that's a fairly big frame rate drop. What does your application do when it's idle?

Try checking the task manager when the frame rate drops, see if anything's using CPU (ctrl+shift+esc).
---PS3dev
Thanks for the reply davedx. Yes it's a C++ app. It uses the typical game message loop, so it just steps the game on idle like so.

MSG msg;
ZeroMemory(&msg, sizeof(MSG));
static DWORD prevTime = GetTickCount();

while(msg.message != WM_QUIT)
{ // The message loop itself
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{ // Process a message
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// Update display
DWORD curTime = GetTickCount();
float elapsed = (float)((curTime - prevTime) * 0.001); // in seconds
if(elapsed == 0.0) continue;
if(m_gameState == GS_PAUSED) elapsed = 0.0f;
step(elapsed);
prevTime = curTime;
}

I'm not moving the camera at all as I'm observing these framerate changes. There are no moving things in the scene except the particles of several particle systems. I examined the task manager after the framerate drop. My game was taking about 85% of the CPU and the process "System" was taking roughly 10%. Miscellaneous other apps like netscape was taking the other 5%.

I had another thought, this may seem far fetched, but could it be my power supply? I'm running on a laptop, but my battery does not work. I have to stay connected to an outlet all the time (if I unplug the laptop will shut off). So my far fetched idea is that somehow my game uses up so much power that the framerate starts to drop, but then after about 8 mins there's enough power again for it to run at full speed? I don't know. But then again, it doesn't seem to affect any other apps, just my game.
........................Leo LeeSoftware Engineerhttp://www.leolees.com
I've seen that second problem occur when using carnegie mellon's cmugraphics library and other graphics libraries. What graphics library are you using??
I am the master of ideas.....If only I could write them down...
I'm using Direct3D. I just shut off all unnecessary programs and tested it some more. Actually this time I ran it, it was not in fullscreen mode. The framerate stayed at about 86-88 and dropped after 4 mins 40 seconds to the 30's. I waited for the app to run 20 minutes and the framerate didn't go back up. I'm baffled...
........................Leo LeeSoftware Engineerhttp://www.leolees.com
Can you tell
nVidia Cards usually reduce speed when they are getting too hot. Maybe working at 90fps is pushing the card too much... so it becomes slower for some time.

Just a guess...
Luck!
Guimo
Hmm.. maybe that's it. I have an ATI Radeon 9000, but yes my fan's definately working hard and my laptop's pretty hot to the touch. I did figure out the second problem. I had forgotten to turn off my profiler's "Instrumentation" option. So I believe that was what caused running outside of VS to be super slow, because now it runs fine outside. If I turned off my dial up internet connection too, now I get the framerate to drop to mid 80's when it's low. It's up at 99 when it's high, but I'm guessing if I turned off vsync it would be higher. So I haven't really solved it, but I can live with 80 fps =o) When I get a chance I'll test it on a different machine and see if it exhibits the same problem, then I can rest assure it's not something weird my program is doing.

Thanks to everyone for your help. I don't post in forums too much, but it's very reassuring to know there's a community so willing to help out.
........................Leo LeeSoftware Engineerhttp://www.leolees.com
Unless your leaking memory or something. *shruggs*
A memory leak was actually my first thought. But I'm pretty sure I don't have any, that DEBUG_NEW thing visual studios does isn't detecting any. Also, if it was a memory leak I would think that if I exited the program VS should clean up after me (at least in debug mode). I've even tried once to run it, wait for framerate drop, reboot my laptop and run it again. It'll stay at the same lower framerate even after I reboot.
Quote:Original post by Anonymous Poster
A memory leak was actually my first thought. But I'm pretty sure I don't have any, that DEBUG_NEW thing visual studios does isn't detecting any. Also, if it was a memory leak I would think that if I exited the program VS should clean up after me (at least in debug mode). I've even tried once to run it, wait for framerate drop, reboot my laptop and run it again. It'll stay at the same lower framerate even after I reboot.


In that case heat seems very likley. Heat is the only thing that really perserves across a restart. Especialy if you have disabled most other tasks.

This topic is closed to new replies.

Advertisement