Visual Studio 2008 Profiler - Instrumented Produces Strange Results

I run the Visual Studio 2008 profiler in the "RelDebug" assembly of my application. Optimization is enabled, but the attachment is only moderate, there are stack frames, and characters are emitted. In other words, RelDebug is a slightly optimized build that can be debugged (although restrictions are usually applied to check variables).

I run both Sampling and Instrumented profiler for individual runs.

Result? A sampler gives a result that looks reasonable. However, when I look at the results of the Instrumental Profiler, I see functions that should not even be closer to the top of the list, and go to it.

For example, a function such as "SetFont", which consists of only 1 line, assigning height to a class member. Or "SetClipRect", which simply assigns a rectangle.

Of course, I look at the "Exclusive" statistics (i.e. minus children).

Does this happen to someone else? This always happens as soon as my application has grown to a certain size. At this point, the device becomes useless.

I understood the problem. Both Visual Studio 2008 and the Visual Studio 2010 profilers are mediocre (to put it politely). I bought Intel C ++ Studio, which comes with vTune Amplifier (profiler). Using the Intel profiler for the same code, I was able to get profiling results that really made sense.

+4
source share
2 answers

You say, "Of course you look at Exclusive." Look at inclusive statistics. In all but the simplest programs or algorithms, almost all the time is spent on routines and functions, so if you have performance problems, it is most likely that the calls you did not know were hours.

This method I rely on. Assuming you are trying to figure out what you can fix to make the code faster, he will find it without wasting time with high-precision statistics on things that are not problems.

+2
source

No mistakes. Sampling cannot tell you how much time you spent on the call. The profiler simply counts how many times the timer got into this particular function. Since SetFont is not often called, you do not get many calls to this function, and you get the impression that this function does not take much time.

On the other hand, when starting the toolkit, the profiler counts each call and measures the execution time of each function. This is why you get accurate information about CPU consumption functions.

When analyzing measurement results, you should always look at the number of calls. Since SetFont is more or less an API, it does not matter if it is exclusive or included. The only thing that matters is its total time and how often it is called.

+1
source

All Articles