• Advertisement
Sign in to follow this  

Maybe a dumb question

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, I just started writing with directx and ive noticed that my framerate drops by half about every 10-15 frames... Im not sure whats causing it but i have it timed out, I lock the framerate at 60 frames a second and it syays pretty consistent but every once in a while it drops to 30 frames for a split second... Anyone seen this before? btw theres about 100 spinning cubes and a flat plane in the scene, nothing too heavy

Share this post


Link to post
Share on other sites
Advertisement
Perhaps you are using the Debug runtime? (You can change this in Windows' Configuration Panel, with the DirectX-icon)

Share this post


Link to post
Share on other sites
hmm tried turning off all the debugging and its still doing the smae thing...
Anyone seen this before?

On an unrelated note im having problems with posix threads, in the start routine the argument is always coming in as null even though i have it set in the call to pthread_create.

Anyone wanna kill two birds with one stone?

Share this post


Link to post
Share on other sites
If you lock the frames at 60fps, and one frame happens to take more than 1/60th of a frame to calculate, then it has to wait the balance of the second 1/60th of a second before it can draw the frame, resulting in 30fps for that one frame. If a few frames in a row are like this, you could have 30fps for quite a few frames in a row. Could that be what is happening?

Share this post


Link to post
Share on other sites
Try keeping tha task manager open while your app is running. This will show you if other programs are using a fair bit of CPU time while your app is running. Perhaps a virus scanner, or the content indexing service, or some other program.
Also, it could be a memory leak, and it may need to page leaked memory out to disk every so often.
If you're using managed code, it's probably the garbage collector kicking in.

Share this post


Link to post
Share on other sites
yea its not managed,

it seems to be keeping 99% of the cpu when running, ill check for memory leaks but i have almost all static memory right now.

thanks for the suggestions though guys ill keep tryin

Share this post


Link to post
Share on other sites
I don't know much about DirectX, but I know that SDL goes to around 100% CPU usage unless you tell the game to yield some performance (using the SDL_Delay function).

Perhaps there is something similar?

Share this post


Link to post
Share on other sites
problem is i dont want it to give up some time, in fact i want the exact opposite

here is an exe of my program, you can see the framerate fluctuations at the top left

use the arrow keys to move around the camera

http://mlinux.homeip.net/dx.exe

Share this post


Link to post
Share on other sites
Well, what I think is happening is that your program isn't giving up any time, and so the CPU scheduler on your OS is throttling it to free up some resources for the other applications that run.

If you yield, chances are it will only surrender the time that other applications need to keep working rather than stuttering once the OS gets fed up and forces your app to yield.

Share this post


Link to post
Share on other sites
You are probably doing something wrong. A normal D3D app doesn't cause any lag, although I had a few times where it did happen, when I forgot to call a function like Present().
Same in OpenGL if you don't call SwapBuffers(), then your system will lag.

Share this post


Link to post
Share on other sites
I figure that i AM doing something wrong, just not sure once, and i've had the same problem with swapbuffers in gl lol.

to give some time back to the OS you need to change the running state of the process,
im trying to have the application sleep() when it is running too fast but it seems to be doing the same thing

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement