Intro To Optimization ToolsNavigation |
Intrusive and Non-intrusiveSubmitted by epreisz on Sun, 02/11/2007 - 08:24.
Sometimes when we attempt to profile an application we will affect the way the program runs due to the overhead of collecting data. Some types of profiling have higher overhead and some have next to none. A profiling tool that requires added processing within the application’s thread is an intrusive profiler. Those that do no require added overhead within the applications thread is a non-intrusive profiler. Let’s take a look at an example of an intrusive profiler that you are likely to encounter. V-Tune is a powerful application for detecting bottlenecks on Intel based PCs. One of the tools V-Tune provides is an application level tool called the call graph. When you run the call graph, V-Tune will instrument the .dlls that your application calls. It also requires you to compile your application with a flag that gives extra information to V-Tune, allowing the program it to track the calls of functions. In Visual Studio 2003, you will set these values by first opening the properties of your project. In the properties window, choose the “linker” folder and the “advanced” sub-category. While in the “advanced” view, set the “fixed base address” property to “Generate a relocation section (/FIXED:NO)” and rebuild your application. In fact, select rebuild all just to make sure. The call graph will use the relocation information to track profiling data; however, you will pay a penalty in performance to collect this information. The trade-off is the ability to report a parent-to-child relationship that we can’t get without being intrusive. When using sampling, the data will write to a database, but does not(measurably) affect the performance of your application thread. Why? The overhead is very little. All that is required is to increment a counter at the address where the time or event occurred. When you are done profiling, you have collected every clock tick and/or event and the number of times it happed. When you compare that database to the source code, you have a view into how much time your program has spent at each line, function, class, or thread. Sampling is a non-intrusive profiler. If you are writing a custom profiler, something I don’t recommend, you should be aware of the overhead you are introducing into your application. |
User login |