What's the best free C++ profiler for Windows? [closed]
Asked Answered
E

13

241

I'm looking for a profiler in order to find the bottleneck in my C++ code. I'd like to find a free, non-intrusive, and good profiling tool. I'm a game developer, and I use PIX for Xbox 360 and found it very good, but it's not free. I know the Intel VTune, but it's not free either.

Ewart answered 15/9, 2008 at 22:15 Comment(2)
VTune appears to be free now: software.intel.com/en-us/vtune. I downloaded the community edition and it does a great job on profiling C++ as well as managed C# codeHexahydrate
How is this off topic? Development tools are on topic as far as I know. It is opinion-based though.Grabowski
M
143

CodeXL has now superseded the End Of Line'd AMD Code Analyst and both are free, but not as advanced as VTune.

There's also Sleepy, which is very simple, but does the job in many cases.

Note: All three of the tools above are unmaintained since several years.

Metonymy answered 15/9, 2008 at 22:18 Comment(8)
Here is the link for CodeAnalyst: developer.amd.com/CPU/CODEANALYST/Pages/default.aspxPromptbook
I tried working with it now, and didn't like it at all. I couldn't even understand how to get function's total time % (including the callees) which TrueTime could do fine 10 years ago.Katinka
I wrote an adaptation of sleepy which doesn't depend in wxWidgets but runs in the command line. You run it for a period of time against a running process and then when you stop it, you get the stats of what the process was spending its time doing. It is non-intrustive in that you don't have to modify your code in any way to use it, but it does suspend your threads as it reads the call-stacks. You also need the pdb files available so that you can get meaningful output, but I guess that applies to any profiler.Meurer
I would recommend trying xperf I found it superior to AMD code analyst.Deficit
CodeAnalyst won't be receiving any more updates except for critical bug fixes. They switched to CodeXL. Here's the link so you can update your answer. And thanks for letting me now about CodeAnalyst/XL, by the way.Samsara
Tried out CodeXL, which is successor of AMD Code Analyst. It can't attach to the existing process. And as for Sleepy, it crashes after 5 seconds of profiling. Both tools are rubbish...Lingenfelter
Worth mentioning that CodeXL works best on AMD processors. On non-AMD it can not show method-level-accurate timings.Apoloniaapolune
AMD CodeXL just doesn't work. It crashes visual studio, most panels never gather any data and the output is confusing. It also doesn't load symbols from project automatically.Cranky
G
67

Very Sleepy is a C/C++ CPU profiler for Windows systems (free).

Gimpel answered 15/9, 2008 at 22:15 Comment(3)
If you're using a Windows binary from the gcc stack, this is a great choice - AMD CodeAnalyst doesn't recognize gcc symbols on Windows, but very sleepy does!Aventurine
Note, latest version of Very Sleepy is from 2014.Puli
Very Sleepy v0.91 is now out: github.com/VerySleepy/verysleepy/releases/tag/v0.91Merrie
P
38

Proffy is quite cool: http://pauldoo.com/proffy/

Disclaimer: I wrote this.

Philippeville answered 15/9, 2008 at 22:15 Comment(1)
#shamelessSelfPromotion :) wink wink*Travistravus
F
19

There is an instrumenting (function-accurate) profiler for MS VC 7.1 and higher called MicroProfiler. You can get it here (x64) or here (x86). It doesn't require any modifications or additions to your code and is able of displaying function statistics with callers and callees in real-time without the need of closing application/stopping the profiling process.

It integrates with VisualStudio, so you can easily enable/disable profiling for a project. It is also possible to install it on the clean machine, it only needs the symbol information be located along with the executable being profiled.

This tool is useful when statistical approximation from sampling profilers like Very Sleepy isn't sufficient.

Rough comparison shows, that it beats AQTime (when it is invoked in instrumenting, function-level run). The following program (full optimization, inlining disabled) runs three times faster with micro-profiler displaying results in real-time, than with AQTime simply collecting stats:

void f()
{
    srand(time(0));

    vector<double> v(300000);

    generate_n(v.begin(), v.size(), &random);
    sort(v.begin(), v.end());
    sort(v.rbegin(), v.rend());
    sort(v.begin(), v.end());
    sort(v.rbegin(), v.rend());
}
Foppish answered 15/9, 2008 at 22:15 Comment(7)
It's easy to use and super-fast profiler. Only one issue I didn't solve is a problem that after I finished debugging, profiler window didn't close automatically and you have to kill it through task manager (without that you can't recompile your project).Entelechy
I found that after I close my app by regular CLOSE button, profiler window can be closed regularly too. But when I exit app by SHIFT+F5 shortcut (Stop debugging VS command), profiler window close button is disabled.Entelechy
Does not work with VS 2015.Apoloniaapolune
Fixed as of 1.1.590. See updates on Visual Studio Gallery page (visualstudiogallery.msdn.microsoft.com/…)Foppish
This is really really good! Should be ranked way higher! Super simple to install and run, and gives you most of what you need to know. My second choice is Windows Performance Analyzer: geekswithblogs.net/akraus1/archive/2015/04/21/163342.aspxBracteole
You can install it directly into Visual Studio (2017+) from the Tools \ Extensions and Updates menu. A MicroProfiler menu item then appears on the main menu.Distal
On VS there is also a CPU Usage tab on the Diagnostic Tools groupDistal
P
10

Microsoft has the Windows Performance Toolkit.

It does require Windows Vista, Windows Server 2008, or Windows 7.

Promptbook answered 15/9, 2008 at 22:15 Comment(2)
How is it not free? It is a part of the Windows SDK. I was able to download it without any problems. (Admittedly, we have an MSDN subscription, so some people might have a different experience than I do.)Promptbook
Free or not, the link no longer works properly.Cranky
J
6

Another profiler is Shiny.

​​​​​

Julian answered 15/9, 2008 at 22:15 Comment(1)
Can't find downloadable binaries, just source codes. Not very convenient.Fiery
D
5

I highly recommend Windows Performance Analyzer (WPA) part of the Windows Performance Toolkit. The command line Windows Performance Recorder (WPR) tool records Event Tracing for Windows (ETW) logs that can be analyzed later using the Windows Performance Analyzer tool. There are some great tutorials on learning how to use the tool.

wpr.exe -start CPU
...
wpr.exe -stop output.etl
wpa.exe output.etl
Deficit answered 15/9, 2008 at 22:15 Comment(3)
Well I know I'm missing working URL to the site.Cranky
I've just tried it, but it never loads the .pdb for my application (after adding the build folder to the symbol path), so it's kinda useless if you actually want to profile C++ code. It's useful if you want to learn everything else the system was doing - it provides an amazing big picture. But for C++ profiling it just didn't do anything.Zwieback
Thats because you need to update the version. There are known buggy versions, try the one from the windows store.Deficit
C
3

I use AQTime, it is one of the best profiling tools I've ever used. It isn't free but you can get a 30 day trial, so if you plan on a optimizing and profiling only one project and 30 days are enough for you then I would recommend using this application. (http://www.automatedqa.com/downloads/aqtime/index.asp)

Comintern answered 16/9, 2008 at 4:47 Comment(3)
Only this tool helped me to profile compiled in release mode mixed (managed and native) web application on IIS.Fiery
It is unfortunate that they do not support people who try to evaluate their product.Want
Currently they are offering a 14 days trial with limited functionality.Parlay
F
1

I used Luke Stackwalker and it did the job for my Visual Studio project.

Other interesting projects are:

Fuss answered 15/9, 2008 at 22:15 Comment(0)
B
1

Please try my profiler, called cRunWatch. It is just two files, so it is easy to integrate with your projects, and requires adding exactly one line to instrument a piece of code.

http://ravenspoint.wordpress.com/2010/06/16/timing/

Requires the Boost library.

Bayou answered 15/9, 2008 at 22:15 Comment(0)
T
0

You can use EmbeddedProfiler, it's free for both Linux and Windwos.

The profiler is intrusive (by functionality) but it doens't require any code modifications. Just add a specific compiler flag (-finstrument-functios for gcc/MinGW or /GH for MSVC) and link the profiler's library. It can provide you a full call tree or just a funciton list. It has it's own analyzer GUI.

Transudate answered 15/9, 2008 at 22:15 Comment(0)
H
0

I use VSPerfMon which is the StandAlone Visual Studio Profiler. I wrote a GUI tool to help me run it and look at the results.

http://code.google.com/p/vsptree/

Hiroshige answered 15/9, 2008 at 22:15 Comment(0)
V
0

I've used "TrueTime - part of Compuware's DevPartner suite for years. There's a [free version](you could try Compuware DevPartner Performance Analysis Community Edition.) available.

Vanwinkle answered 16/9, 2008 at 3:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.