[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2011-02-27
4
Medium Priority
?
1,102 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

650 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