Solved

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

Posted on 2011-02-27
4
978 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
4 Comments
 
LVL 3

Accepted Solution

by:
sergiobg57 earned 500 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with consolidating excel files using VB.net 2 29
Help with opening combobox using VB.NET. 3 25
MailAddress in vb 4 29
VB.NET Textbox input validation 4 37
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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