Render Time laggs every +- 1 sec

Started by
12 comments, last by G-Man9566 13 years, 9 months ago
Hi,

This one baffels me completely.

When I render, about every second one frame would take plus minus X + 100ms to render, where the rest of the frames would render at Xms.

If im not clear enough. On average the frames would render at say, 40ms and then every 25th frame would take 140+ms to render. And all the time all the frames gets render the same way, as far as I can see.

Im using D3D9.

Advertisement
First you should try to figure out where the additional time is burned. The simplest check here is to measure the time it spends inside the Present call.

What you might although check is if you allocate any resources inside your render loop. This can although cause stalls when the heap needs to be cleaned up.
Quote:Original post by Demirug
First you should try to figure out where the additional time is burned. The simplest check here is to measure the time it spends inside the Present call.

What you might although check is if you allocate any resources inside your render loop. This can although cause stalls when the heap needs to be cleaned up.


Cool, I'll have a look at this.
this is the output of the delta time it took to "Present" with m_d3dDevice->Present( 0, 0, 0, 0 ), and it looks very inconsistent.

Note that there is nothing happening in my scene when I took these delta times, no animations or camera moving or things being drawn different or anything like that, I stood at a constant place in my scene when I took these delta times.

The time is in seconds

0.0462922
0.06112453
0.01720945
0.03615823
0.07129984
0.02106329
0.03527515
0.07011282
0.00008604
0.00009554
0.005107353
0.01618977
0.03664935
0.04424417
0.04020232
0.06294459
0.03231053
0.06017301
0.02805943
0.03923906
0.03404008
0.00009414
0.0001056
0.00009163
0.03019462
0.03490583
0.04021573
0.03801684
0.05405296
0.04409052
0.02509816
0.06810139
0.00009358
0.0678089
0.02816196
0.00009274
0.00009470
0.00009163
0.02619411
0.03536706
0.04041575
0.04232968
0.03396465
0.06560359
0.01413113
0.06929596
0.00009135
0.05595935
0.00008911



[Edited by - G-Man9566 on July 21, 2010 4:30:10 AM]
Does anybody have an idea why this happens?
Hmm, it's hard to tell.

It could be a bug in your timer implementation which is showing up as frame drops.

Maybe download and run fraps and see if that matches up with your frame-rate counter. At least that way you have cut out one of the potential problems...
Quote:Original post by Westie007
It could be a bug in your timer implementation which is showing up as frame drops.


thanks, but I have tested my timer before and it works very well, so its not that. when I do navigate through my scene, it actually feels like something is holding you back every +-1 second, when that frame takes longer to render than the rest.
this is an example of my frame times in ms that I got from Fraps' benchmark utility.

214
25
26
44
50
71
71
90
47
68
95
67
42
61
215
27
27
30
56
74
75
61
70
71
67
66
72
67
217
25
26
25
67
49
68
80
84
43
61
84
87
42
61
215
What function are you using as a timer? GetTickCount() (Very bad), timeGetTime() (Probably ok), or QueryPerformanceCounter() (Fine so long as you know it can give gibberish results sometimes)?

EDIT: Never mind if FRAPS is giving the same results.


You really need to run your code through a profiler and see what takes all the time on a "long" frame.
Quote:Original post by Evil Steve
You really need to run your code through a profiler and see what takes all the time on a "long" frame.


Ill do that. its just weird that if I startup my pc and run my engine directly after startup, then most of the time it does not do that one long frame every couple of frames.

I tested it once by starting up my machine and running the engine, no long frame, I then started skype and there goes the long frame, closed skype and the long frame stops. but after some time of operating on my pc it does not matter if I start or stop skype, it still renders on frame very long. Once, on another machine I ran GameBooster and then it stopped with the one long frame.

Could it be that I am handling my rendering sequence in Application::Idle. Im registering to the System::Application::Idle event and do Engine->Run in the function that is registered to that event.

This topic is closed to new replies.

Advertisement