AQTime’s profilers track entry and exit points of a function. When a function is set as inline, the compiler may insert a copy of the function body in each spot it is called (or it may disregard the directive). Obviously, with a true inlined function, there are no entry and exit points to track, so AQTime will include profiling results of that function into results of its parent function (or functions).
If you want an inline function to be profiled, you must set your compiler not to inline it. How you do this, depends on the compiler you use. Below is information for Microsoft Visual C++, Borland C++Builder and .NET compilers.
The JIT compiler compiles and optimizes the code of a managed application during the application run. The compiler uses specific algorithms to decide whether to inline a function or not. The easiest way to disable inlining for applications created with .NET compilers is to enable the Disable inlining option of the Performance or Coverage profiler before the profiler starts. When this option is on, routines in the profiled application are not inlined.
An alternative way to using the option is to specify the
NoInlining method attribute in source code. For instance:
public void foo()
// function code
Both Microsoft Visual C++ 6 and Microsoft Visual C++ 7 distinguish several ways, in which an inline function is specified as inline:
For a member function, having its body declared in the class definition.
#pragma auto_inline to tell the compiler to inline functions according to criteria of its own.
The Visual C++ compiler includes the Inline Function Expansion option that specifies which inline functions the compiler will inline. To modify this option:
In Visual Studio .NET 2002, 2003, Visual Studio 2005 and later:
Select Project > <project name> Properties from the main menu of Visual Studio. This will call the Project Properties dialog.
In the dialog, select the Configuration Properties > C\C++ > Optimization node from the tree on the left.
In Visual Studio 6.0:
Select Project > Settings from the main menu of Visual Studio. This will call the Project Settings dialog.
In the dialog, switch to the C\C++ tabbed page.
Select Optimizations in the Category box.
Possible values for the option are --
|Default||Disables inlining. This is the simplest suitable solution for using AQTime.|
|Only __inline||The compiler will inline functions marked with the
|Any suitable||The compiler will produce inline code for all functions marked as inline as well as for any other suitable functions defined under
So, in order to make all the inline functions available for profiling, we recommend to set the Inline Function Expansion option to Default.
Borland C++Builder includes the Disable inline expansions option that lets you disable inlining. That is, if this option is on, the compiler produces standard code for all inline functions, so AQTime can profile inline functions of any kind.
To modify this option:
Select Project > Options from the C++Builder’s main menu. This will call the Project Options dialog.
Switch to the Compiler tabbed page. The Disable inline expansions option is in the Debugging section of this page.
To see how inline functions are profiled, you can use a sample application supplied with AQTime, Inline:
<AQTime Samples>\Unmanaged\Inline\VC2005 - Microsoft Visual C++ (Visual Studio 2005 project, can also be opened and compiled in later versions of Visual Studio.)
<AQTime Samples>\Unmanaged\Inline\VC2013 - Microsoft Visual C++ (Visual Studio 2013 project)
<AQTime Samples>\Unmanaged\Inline\BCB - Borland C++Builder
|On Windows Vista and later, AQTime samples are located in the <Users>\Public\Documents\AQTime 8 Samples folder. On other operating systems, the samples reside in the <Documents and Settings>\All Users\Documents\AQTime 8 Samples folder.|