[SlimDX] MessagePump.Run and CPU

Started by
0 comments, last by Adam_42 12 years, 10 months ago
Hi,
I got a very simple program ...

static class Program
{

/// <summary>
/// Point d'entrée principal de l'application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);

Form1 form1 = new Form1();
//form1.init();
MessagePump.Run(form1, () =>
{
//form1.run();
});

//form1.clear();

}
}
}


Form1 do nothing (Constructor empty)

When i run the program, it use 50% of my CPU ! (It's a Intel Core 2 Duo that's why it uses "only" 50%)

Is that normal ?
Advertisement
From reading http://slimdx.org/tutorials/basicwindow.php I believe that is as designed. Games are generally written to render frames as fast as the PC allows which if you're CPU bound and single threaded means fully using one CPU core.

If you do enough rendering work (or VSync is on) then the CPU usage should drop as the CPU waits for the GPU to finish at the end of each frame (well, actually there's a buffer of about 3 frames to let them work in parallel).

For non-game uses you may want to render in response to paint messages like a normal Windows program, instead of rendering as fast as possible.

This topic is closed to new replies.

Advertisement