What's a Very Easy C++ Profiler (Vc++)

What's a very easy C++ profiler (VC++)?

VS built in:

If you have team edition you can use the Visual Studio profiler.

Other options:

Otherwise check this thread.

Creating your own easily:

I personally use an internally built one based on the Win32 API QueryPerformanceCounter.
You can make something nice and easy to use within a hundred lines of code or less.

The process is simple: create a macro at the top of each function that you want to profile called PROFILE_FUNC() and that will add to internally managed stats. Then have another macro called PROFILE_DUMP() which will dump the outputs to a text document.

PROFILE_FUNC() creates an object that will use RAII to log the amount of time until the object is destroyed. Both the constructor of this RAII object and the destructor will call QueryPerformanceCounter. You could also leave these lines in your code and control the behavior via a #define PROFILING_ON

What's the best free C++ profiler for Windows?

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.

What are some good profilers for native C++ on Windows?

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

Recommendations for C Profilers?

Using gcc, I compile and link with -pg (as explained e.g. here), then continue by running the program (according to the principles also suggested at that URL) and using gprof. The tools will vary if you're using different compilers &c, but the URL is still recommended, even then, for the parts that are about general ideas on how and why to profile your code.

VC++ Memory profiler

For 1 and 2 you could just

void *log_malloc(const char *file, int line, const char *function, size_t size) {

void *mem = malloc(size);

/* log or do something with file, line, function, size and mem */

return mem;

#define malloc(size) log_malloc(__FILE__, __LINE__, __func__, size);

And the same for free, calloc, etc.

How should I profile visual c++ express?

First, the polar angular velocity of the car should be proportional to the speed of the car and to the angular position of the steering wheel (to a first approximation).

Second, there's hardly a professor or blogger or book author who will tell you this, but if you want to see what the code is doing and optimize it, the hands-down simplest way is this.

Added: Programmers have a strong tendency to assume that any automated profiling tool will do a better job than the manual technique, but that depends on the details of exactly what they do. Most of them implement what's popular rather than what is most effective. The result is some performance problems being missed, putting a cap on the speedup you can get. Here is a list of common misconceptions that result in failing to find performance problems.

Some profilers do get it nearly right, including RotateRight/Zoom and LTProf.

Free profiling in C++?

  1. AMD Code Analyst
  2. Sleepy

A little googling gives a impressive list of freebies(disclaimer: I haven't used these):

  1. Shiny
  2. Google Test
  3. Windows Performance Analysis


Decent profiler for Windows?

Intel VTune is good and is non-instrumenting. We evaluated a whole bunch of profilers for Windows, and this was the best for working with driver code (though it does unmanaged user level code as well). A particular strength is that it reads all the Intel processor performance counters, so you can get a good understanding of why your code is running slowly, and it was useful for putting prefetch instructions into our code and sorting out data layout to work well with the cache lines, and the way cache lines get invalidated in multi core systems.

It is commercial, and I have to say it isn't the easiest UI in the world.

Related Topics

Leave a reply