# Terrible frame hiccups, 200ms for 0 triangles!

This topic is 2944 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

As I've been playing with my program lately I've been noticing a weird problem. The game runs really smoothly (<2ms whole frame time) as measured with Hi-Res timers, although every so often get a really bad framerate hiccup that's very noticible during gameplay. I profiled it to the renderer, then to swapbuffers, and started removing pieces of the rendering pipeline until I could see what was causing it. Unfortunately I'm to the point where I've removed Everything from the rendering pipeline, and its still happening. This is now the entirety of my program, I call SwapBuffers in a loop and do nothing else. No glClear, no updates, nothing.

while (!exiting)
{
if(initialized) { //Ignore very first startup frames

timer.startTimer();
SwapBuffers(hDC);
timer.stopTimer();
rendertimes = timer.getElapsedTime();
timer.clearTimer();
}
i++;
if(i==1000){
i=0;
if(initialized==true){
int stop = 1;//Breakpoint here
}
initialized=true;
}

while (PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE))
{
if (!GetMessage (&msg, NULL, 0, 0))
{
exiting = true;
break;
}

TranslateMessage (&msg);
DispatchMessage (&msg);
}


I break after going through the second thousand frames and scroll through the rendertimes in the debugger. Scrolling down the list most are 0.1ms which is ok, but then every so often I'll see one enormous frame, sometimes several in a short time. I could see something like this: 0.0001 0.0001 0.0001 0.2014 0.0001 0.0001 0.0941 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0380 0.0001 0.0001 0.0001 Game is freezing for 200ms to perform a single frame! Any thoughts what I can do to stop this? Edit: OS is Windows Vista, GPU is 8800GTS [Edited by - karwosts on April 29, 2010 11:51:32 AM]

##### Share on other sites
Total long shot: try switching to PM_REMOVE.

Also, are you running with vsync enabled?

##### Share on other sites
I can try that later when I get back, although my message loop is outside the timer so I'm not sure if that will help much.

I'm pretty sure vsync is off, like I said typically the loop time is ~0.1ms

• 10
• 18
• 14
• 18
• 15