Click to See Complete Forum and Search --> : One DX9 app stutters when Task Manager updates, another doesn't.


alexgibbs
April 5th, 2005, 03:36 PM
I wrote a non-DirectX program that runs with two DirectX 9 games (App1 or App2). My MFC program has a dialog with a static control that updates twice a second. App1 runs smoothly with my program but App2 stutters when my program updates its control. My program uses 1% of the CPU when App1 is running but 30% of the CPU when App2 is running. My program is doing the same thing, so what could be different about App2 that causes this problem?

The same thing happens if I run the Windows Task Manager instead of my program. The CPU usage of Task Manager goes up with App2 and App2 stutters. This doesn't happen with App1.

This problem occurs whether my dialog is topmost or not. It also occurs whether my dialog clips App2 or is off to the side. It occurs whether I update a static control or BitBlt a bitmap. The problem does NOT occur when I stop my dialog from updating. It does not occur when my dialog is minimized or covered up.

App2 does not like other windows updating. If I knew why then maybe I could figure out how to work around it. I'm running Windows XP Pro and DirectX 9.0c. Thanks in advance for suggestions as to the cause or even solutions!

Arjay
April 5th, 2005, 05:18 PM
Does your app stutter more frequently if you change the task manager update speed (normal updates every 2 seconds, change it to high)?

If the your app stutters more frequently, it may be related to the increased cpu load on the system. Task manager uses quite a bit of resources when it builds its process list and enumerates the top level windows - on high update, it's doing this every 1/2 second.

Is your app multithreaded? If so, are there architectural differences between app1 and app2? Is app2 holding on to locks longer than necessary?

Arjay

alexgibbs
April 5th, 2005, 08:09 PM
My explanation was pretty involved so here is a simpler case. I made a new MFC app that is just a normal dialog showing a counter that updates once a second (using WM_TIMER). Call it Counter. App1 and App2 are both DX9 games, not written by me.

- Run Counter. It's CPU use is < 1%.
- Run App1. Counter's CPU use is < 1%. App1 runs smoothly.
- Exit App1.
- Run App2. Counter's CPU use goes up, with peaks around 30%. App2 stutters or glitches exactly when Counter updates.
- Minimize or cover up Counter. Counter's CPU use goes back to < 1% and App2 runs smoothly.
- Replace all above occurances of "Counter" with "Windows Task Manager" and the results are basically the same.

Counter was always doing the same thing. The increased CPU use is the cause of the stuttering. But what is causing the increased CPU use that is being attributed to Counter? It seems to only occur when Counter is updating/painting while App2 is running. How is App2 causing the CPU use of Counter to increase? :ehh:

Arjay, yep the stutter rate is the same as the update rate. Sorry the first post was pretty confusing.