Determining source of high processor usage

145 views Asked by At

I've added ICQ# library (it's open source) to my application. But if I connect to ICQ server though it, it will increase usage of CPU (up to 30%). So something in ICQ# library is using CPU so much. But I don't know how to determinate what is it and reduce the usage of CPU.

3

There are 3 answers

1
Rob P. On BEST ANSWER

If it's open source and you've added the code to your project; run it with a profiler attached.

0
jalf On

The very simplest approach is this:

  1. Run your program in the debugger.
  2. And break into the debugger at some point.
  3. Look at the call stack wherever you are
  4. repeat steps 2-3

Doing this just two or three times gives you a very good idea of where most of your execution time is being spent. If most of the execution time is spent in one function, then that function will be on the call stack nearly every time you break into the debugger.

0
jauseg On

I find it in 'icq_sharp\IcqSharp.Util\Timer.cs' file. See function: private void DoWorker(). There is a loop without delay. Just add Thread.Sleep(10);