17

I'm looking for a profiler to use with native C++. It certainly does not have to be free, however cost does factor into the purchase decision. This is for commercial work so I can't use personal or academic licensed copies.

The key features I'm looking for are:

  • Process level metrics
  • Component level metrics
  • Line-level metrics
  • Supports Multi-threaded code
  • Usability
  • Cost
  • Visual Studio 2005 Professional support required (VS 2008 Professional support highly desirable)

I've used Intel's VTune and Compuware's Devpartner Performance Analysis Community Edition.

VTune seemed very powerful but it has a steep learning curve. It also is very "modular" so you have to figure out what parts are you need to buy.

DevPartner PACE was pretty easy to use and provides all of the key features however it's only a 45-day trial. The licensed version (DevPartner for Visual C++ BoundsChecker Suite) is about $1400 a seat, which is doable but a bit high imo.

What are some good profilers for native C++ and WHY?


See also:

What's Your Favorite Profiling Tool For C++

Community
  • 1
  • 1
Zach Burlingame
  • 13,476
  • 14
  • 56
  • 65
  • 1
    :Sigh: I searched for several minutes for C++ and profiler but nothing came up because they used profiling and didn't use the profiler tag. – Zach Burlingame Sep 30 '08 at 15:41
  • 1
    Unfortunately that question is not an exact duplicate. They didn't state their requirements for the profiler. The discussion that follows is short on details of WHY. I think asking for recommendations on a tool given certain criteria makes for a more "answerable" ? than asking for a "favorite". – Zach Burlingame Sep 30 '08 at 15:43
  • @Burly: You make a good argument - you wrote a good, focused question, and the answers may not necessarily correspond to those appropriate for the other. I will re-open. – Shog9 Sep 30 '08 at 16:00
  • Almost 8 years later, how does Visual Studio fit in? I've been using the built-in profiler since VS 2012, and it keeps getting better and better with every release. What are the advantages of the (commercial) competitors in this area today (if any)? – IInspectable May 16 '16 at 21:22

8 Answers8

9

On Windows, GlowCode is affordable, fairly easy to use, and offers a free trial so you can see if it works for you.

AShelly
  • 34,686
  • 15
  • 91
  • 152
3

Many people are not aware but MSFT is making a great progress putting the best possible tools for improving performance in the hands of devlopers for free :-). They are exposing to all of us the internals of Windows tracing: ETW.

perftools

It is part of the new windows SDK for server 2008 and Vista. Simply impressive and must to download if performance analysis and profiling under Windows is your goal (regardless of language).

Check the documentation here before you decide to download it:

msdn doc

user
  • 5,335
  • 7
  • 47
  • 63
mastermind
  • 673
  • 7
  • 10
  • 7
    IIRC perftool is more a system performance monitor (CPU vs disk/network loading) rather than a function level code analyser? – Martin Beckett Feb 08 '10 at 16:11
  • This lacks fidelity for actually performance tuning native apps :( – kfsone Aug 29 '18 at 03:56
  • It also seems to generate such huge dumps that you can't reasonably profile anything that runs for an extended period of time. I used UIforETW (by the chrome guys) as well. If you're just looking at basic values, it's ok, but if you need deep insight, 30s quickly starts to add up to 12GB of data. – kfsone Aug 29 '18 at 03:58
3

Try Intel Parallel Studio. Currently, it's in beta, but the name Intel says it all.

http://www.intel.com/go/parallel

sivabudh
  • 31,807
  • 63
  • 162
  • 228
2

CodeXL may also be worth looking at, it can run on both Linux and Windows, although it is mainly dedicated to OpenGL/OpenCL debugging and profiling there is a time based sample option for CPUs under the profiling section which maybe helpful. It's also free and works as long as pdb files are available (well on windows, I don't know how it works on Linux) (even for release builds with pdb).

afree100
  • 191
  • 1
  • 8
  • +1: it was the only tool (among free ones) which could provide any meaningful results for my binary built in Release configuration with Visual Studio Community 2017 (C++, STL, OpenCV) – AntonK Jul 29 '17 at 22:25
2

Just found Luke StackWalker on SourceForge (http://lukestackwalker.sourceforge.net/). Unfortunately it does not have a 'focus on sub tree', but it remains handy to use, uses the symbol server (I suggest you set it up immediately if you don't have it yet), offers a graphical visualisation, ...

The down side is that it doesn't show the accumulated times (samples) of the child functions.

Another alternative is "Very Sleepy" (http://www.codersnotes.com/sleepy). It can show the accumulated times of the children, but unfortunately it doesn't use the symbol server.

Patrick
  • 23,217
  • 12
  • 67
  • 130
1

Definitely Visual Studio Team System. By far.

Alex Budovski
  • 17,947
  • 6
  • 53
  • 58
1

I just finished the first usable version of CxxProf, a portable manual instrumented profiling library for C++.

It fulfills your requirements:

  • Profiles multithreaded applications
  • Support for profiling multiple processes throughout the same network is on the way
  • It is written with the best usability and easiest integration in mind
  • It's free as in beer and free as in speech
  • It will work with VS05,08,10,12 and 13. As well as with g++ on Linux. It's currently tested with VS 2013 Express.

See the project wiki for more info.

Disclaimer: Im the main developer of CxxProf

MOnsDaR
  • 8,401
  • 8
  • 49
  • 70
1

I wrote an open source lightweight win32/64 profiler, support both CPU and memory profiling, it's kind of similar with VS profiler, but with unique feature like flame graph of CPU and memory data. it's here: dprofiler

xwlan
  • 11
  • 2
  • 1
    I didn't downvote you - I don't like to do that. But IMHO the whole concept of profiling is based on massive self-deception in the programmer community, and needs revision. Check [*this answer.*](http://stackoverflow.com/q/25865264/23771) – Mike Dunlavey Dec 21 '14 at 18:52
  • Mike, I'm not sure whether you checked the code, this profiler does not work as gprof (CPU profiling), it samples all threads and compute weights of IPs, grouped as call tree etc. no code recompiling required. – xwlan Dec 22 '14 at 03:26
  • Mike, my post may confuse you that "similar with VS profiler", I need clarify that its UI, counters etc are similar with VS profiler, but they work in different ways. VS profiler (before VS2012) samples only IPs. dprofiler samples by collecting all threads' stack traces, so dprofiler can group stack frames into call tree. – xwlan Dec 22 '14 at 03:48
  • I'm sure you can create a call tree. Now some questions: 1) can you take stack samples during I/O, sleep, or other process blocks? 2) Can you allow the user to examine individual stack samples, at line-level resolution, in a way that lets them relate it to the corresponding code? I'm asking because otherwise it is easy for big speedups to hide in call-trees, hot-paths, or any such summary, as that link points out. The typical objection is the user cannot examine enough samples - which is not true. If he sees a problem on 2 samples, that is enough. – Mike Dunlavey Dec 22 '14 at 12:42
  • 1
    Q1: Yes. The sampler periodically take sample whatever the target thread is doing. in view, each sample has an associate state, executing, sleeping, or in i/o (pending in kernel). – xwlan Dec 22 '14 at 14:28
  • Q2: The tool resolve symbol into source line if there's appropriate symbol (though not in all views). Thanks for your comments. in fact, I refered to your ideas during development of dprofiler :). – xwlan Dec 22 '14 at 14:31
  • So if I'm a user I can bypass the call tree and I can ask: "Please choose a single stack sample at random (from the thread I choose) and let me examine it" ? Then I can ask for several more the same way? That's the key to the random-pausing method - bypassing the summaries and actually examining samples as if they were bugs. (I know users may expect the summaries, but for really finding speedups, you need to actually examine samples.) – Mike Dunlavey Dec 22 '14 at 14:53
  • Open view, move the red slider to select a sample range, click on the following thread rows, each cell represent a sample, the bottom listview show the full stack trace of this sample, move the cursor on cells B/F/U/Downward, you can browse the whole history. to avoid extended discussions in comments, I will not follow up this thread, sorry. we can discuss by email. – xwlan Dec 22 '14 at 15:16