Wednesday, December 19, 2007 1:51 PM
kolbis
Give me 1 minute I will tell you who is your CPU consumer
How can you tell which method consumes most of your CPU?
I had an application that consumed a lot of CPU. I have noticed it through the performance monitor. The performance monitor does not give you an indication on what is the most consuming method, rather it give you a general idea on how you critical resources behave during the application run.
However you can use the Visual Studio Profiler or other tools, but believe me, this will take more than one minute. Actually it can take you a few hours.
Here is a trick my friend, Eran Carmel, thought me.
Execute the application in Debug mode, once you see that the CPU usage is high (through the perfmon), pause the debugger and write down the method you are currently executing. Now let the debugger finish the execution and terminate it.
Repeat this process three times, if at all the three times you reach the same method, you have found yourself the method that is consuming your CPU.
תגים:Performance