how to reduce CPU usage of WPF application?
-
My WPF application used high CPU usage after about 30 minutes, then i break the application to find out what code spent high CPU usage, but i got nothing. Visual Studio 2008 can't display current running code, but i found this in "Call Stack" panel:
[In a sleep, wait, or join] mscorlib.dll!System.Threading.WaitHandle.WaitAny(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) + 0x8f bytes System.dll!System.Net.TimerThread.ThreadProc() + 0x2f9 bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x66 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x6f bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes
what's this? what's matter with high CPU usage? and how to reduce the CPU usage? PS: I used Performance Profiling for WPF tool to found out which events or element take high CPU usage, then we found:Tick(TimeManager.Tick())
was take about 40% CPU usage of app. which events will call TimeManager.Tick? how to reduce it? – Cooper.Wu 5 secs agoGlad to discuss with you and best wishes.
-
My WPF application used high CPU usage after about 30 minutes, then i break the application to find out what code spent high CPU usage, but i got nothing. Visual Studio 2008 can't display current running code, but i found this in "Call Stack" panel:
[In a sleep, wait, or join] mscorlib.dll!System.Threading.WaitHandle.WaitAny(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) + 0x8f bytes System.dll!System.Net.TimerThread.ThreadProc() + 0x2f9 bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x66 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x6f bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes
what's this? what's matter with high CPU usage? and how to reduce the CPU usage? PS: I used Performance Profiling for WPF tool to found out which events or element take high CPU usage, then we found:Tick(TimeManager.Tick())
was take about 40% CPU usage of app. which events will call TimeManager.Tick? how to reduce it? – Cooper.Wu 5 secs agoGlad to discuss with you and best wishes.
TimeManager is part of the framework and it is related to the animation subsystem. Do you have a lot of animations going on in your app?
Blog: http://windowsclientdevelopment.spaces.live.com FAQs: http://windowspresentationfoundation.wikispaces.com http://windowsmobile.wikispaces.com http://vsto.wikispaces.com