how to debug the app taking a long time to run?

Posted on 2011-10-10
Medium Priority
Last Modified: 2013-12-16

I have this visual c# app doing some calculation and give out the output.
It used to take a few seconds not it is taking at least 20 min to finish.
The original author fixed a few things.

How can I debug and test it why it is taking so long?
Question by:dkim18
LVL 45

Expert Comment

ID: 36942684
>>The original author fixed a few things.

Sounds like someone has written in a new bug - any documentation as to what 'fixes' were implemented?
LVL 40
ID: 36943021
Without the code, it's hard to tell.

You might want to put a few lines like the following in the code and test the application in debug mode:
DateTime stepStart;

stepStart = DateTime.Now;
// First part of your calculation
Debug.WriteLine ( "Step 1 : " + DateTime.Now.Subtract ( stepStart ).TotalSeconds.ToString() );

stepStart = DateTime.Now;
// Second part of your calculation
Debug.WriteLine ( "Step 2 : " + DateTime.Now.Subtract ( stepStart ).TotalSeconds.ToString ( ) );

Open in new window

When the calculation is over, the Output window will indicate the time in seconds that you spent in each step of the calculation. That will help you to spot where you should look for the slowdown.
LVL 13

Expert Comment

by:Naman Goel
ID: 36943102
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.


Author Comment

ID: 36943361
I forgto mention that I am vs 2010 ide.
Is there any tool I can use from VS?
LVL 13

Accepted Solution

Naman Goel earned 1000 total points
ID: 36943885
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 1000 total points
ID: 36944290
If you have the Premium edition of Visual Studio, you can use the performance tools under the Analyze menu.

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

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

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
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

840 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