Re: C++ runtime profiling

David Z Maze <>
Mon, 25 Jun 2007 11:24:55 -0400

          From comp.compilers

Related articles
C++ runtime profiling (Amit Gupta) (2007-06-22)
Re: C++ runtime profiling (David Z Maze) (2007-06-25)
Re: C++ runtime profiling (Russ Cox) (2007-06-25)
Re: C++ runtime profiling (regan) (2007-09-04)
C++ runtime profiling (Michael Dunlavey) (2012-01-13)
| List of all articles for this month |

From: David Z Maze <>
Newsgroups: comp.compilers
Date: Mon, 25 Jun 2007 11:24:55 -0400
Organization: Massachusetts Institute of Technology
References: 07-06-058
Keywords: C++, testing
Posted-Date: 25 Jun 2007 11:30:10 EDT

Amit Gupta <> writes:

> I wonder if there are other good open-source runtime profilers for C+
> +. My minimal knowledge indicates either gprof and to some extent
> cachegrind (little different). What other tools are out there? Is
> gprof the best out there for free profilers? Please, open-source and
> free tools are important keywords in my message.

oprofile [1] is a very useful whole-system profiling tool, particularly
if you're using 32-bit x86 Linux. It can identify which processes are
using the most CPU cycles, and can drill down as far as individual
instructions. You can also set it to look for specific other things
(e.g. branch mispredicts). The upside is that you can run unmodified
code under it; the major downsides are requiring Linux kernel support
and not being able to gather exact call-profile statistics (gprof I
belive logs every call in addition to taking periodic samples).

You mention cachegrind; I wouldn't even attempt to use any of the
greater valgrind tool suite for any sort of performance testing, since
it works by emulating the entire machine with hooks for plug-ins to do
extra work, most frequently checking that memory accesses refer to
initialized memory. If you're sure that cache misses are your
performance problem it might be helpful, but I don't know how you'd
determine that without starting with a broader profiler.



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.