Windows Message Queue and Processor Performance
Posted on 2007-08-08
I'm new to windows programming, and there is something that really confuses me.
I am working on legacy code where the application logic is contained in various OnTimer calls in an MFC dialog based program that runs on a WinXP embeded system.
What appears to be happening is that the program spends "to long" in the timer event handler before responding to other messages like button clicks and such. This causes a noticable delay in the system responsiveness when user interface features are used.
However, when I look at my processor usage in task manager, the processor is barely being utilized. If there are events in my windows queue, and meaninful work to be done, why isn't the processor being used more? The code that gets processed in the timer event handler does not use any Sleep, mutex, or file IO function, so why the holdup?
I am in the process of moving most of the application logic to different threads to free up the user interface thread, but it would be really helpful if, atleast temporarily, I could increase the CPU timeslice or some other "parameter" to improve processor usage for the application. We use Microsoft's Target/component designer to build customized WinXP images, so maybe there's something in there I can change?