Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance bottleneck - using Visual Studio

I'm looking for a way to find bottleneck methods in a solution (lots of projects).

Lets say i have a HUGE program (1000s of methods) and i want to improve performance by finding methods that are called a lot (actually used at runtime), and optimize them.
I need this for a complex problem that's written in C++, C#, CLI/C++. (I can compile it all in debug and have the .pdb files)
So, I'm looking for some kind of analyzer that will tell me how much cpu time each method is using.

What tool/addon/feature can I use in Visual Studio to get that information ?
I want to be able to run the program for a few minutes, and then analyze the method's cpu usage. Or even better - amount of cpu / number of calls.
Would be even better if I could sort by namespace or dll/package/project.

like image 712
Yochai Timmer Avatar asked Jul 16 '11 13:07

Yochai Timmer


People also ask

How does Visual Studio measure performance?

Open the Performance Profiler by choosing Debug > Performance Profiler (or Alt + F2). For more information on using the CPU Usage or Memory usage tool in the Performance Profiler vs. the debugger-integrated tools, see Run profiling tools with or without the debugger.

What is performance profiler in Visual Studio?

Profiling and diagnostics tools help you diagnose memory and CPU usage and other application-level issues. With these tools, you can accumulate performance data while you run your application.

How do I check CPU usage in Visual Studio?

To bring up the window again, click Debug > Windows > Show Diagnostic Tools. You can choose whether to see CPU Usage, Memory Usage, or both, with the Select Tools setting on the toolbar. If you are running Visual Studio Enterprise, you can also enable or disable IntelliTrace in Tools > Options > IntelliTrace.


2 Answers

The more expensive Visual Studio versions should provide a Profiler builtin: see this thread.

However there are more methods to profile, this topic has been covered a lot of times on stackoverflow, here for example.

like image 141
Christian Goltz Avatar answered Oct 10 '22 14:10

Christian Goltz


Following one of Christian Goltz links, I've found a program that might do what I want, it profiles both managed and unmanaged code:

AQTime Pro

like image 22
Yochai Timmer Avatar answered Oct 10 '22 14:10

Yochai Timmer