?
Solved

My C# Application causing high CPU. How to debug?

Posted on 2011-02-27
4
Medium Priority
?
1,043 Views
Last Modified: 2012-05-11
I have a C# application which I have made. It does 100+ different tasks and recently I made some changes in my code that has started to cause random high CPU usage.

Unfortunately I have lost track of the last set of changes I had made and trying to troubleshoot it by disabling 1 function at a time would be very time consuming.

My program also runs about 40 different threads so using the debugger to chase the code 1 step at a time isn't very helpful either.

I know my program doesn't generally use so much CPU. So I have some logic error somewhere but very hard to find!

Any tips on how I can troubleshoot this better? Pehaps theres a better way to make use of the debugger tool?
0
Comment
Question by:ultramoo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 3

Accepted Solution

by:
sergiobg57 earned 2000 total points
ID: 34991196
Use a profiler.
It will tell how many times methods were called and how long it took them to complete.

I just know one which is free of charge:
http://www.eqatec.com/Profiler/

Open in new window

0
 
LVL 11

Expert Comment

by:Sudhakar Pulivarthi
ID: 34996168
Hi,

You can get some more free profilers.
http://csharp-source.net/open-source/profilers

Download a free trial of these performance testing tool for solving ur issue.
http://www.red-gate.com/products/dotnet-development/ants-performance-profiler/
0
 

Author Closing Comment

by:ultramoo
ID: 34996171
Thanks didn't know such programs existed.

The profiler says how long it took but doesn't say how much CPU cycles it took - Some of my methods have Thread.Sleep commands so the length doesn't really help.

Still I was able to figure out a lot from this. If you know of any profiler that can show CPU cycles used that would be great!

I'll keep searching around.
0
 
LVL 15

Expert Comment

by:Russell_Venable
ID: 35000114
Why don't you use process explorer or process monitor from systeminternals.com it's free and it allows you to learn how your program works and show's CPU usage as well as threading operations among other hard to track down problems.
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question