Once you press the Run button to start profiling, AQTime launches your application, instruments it (prepares it for profiling) and then starts collecting statistics on the applications execution. Though almost all applications can be started under AQTime, doing this can be a non-trivial task for some types of applications.
AQTime offers the “Attach to Process” feature that makes things easier. Profiling with this feature means that the profiled application is not started using AQTime: AQTime can connect to the application and instrument it on the fly. This feature is supported by the following profilers:
See how the “Attach-to-Process” feature works:
|AQTime: Attaching to Process|
- Performance Profiler
- Allocation Profiler
- Resource Profiler
- Coverage Profiler
- Light Coverage Profiler
- Exception Trace Profiler
- Failure Emulator Profiler
- Function Trace Profiler
- Load Library Tracer
- Sampling Profiler
AQTime cannot attach to a process that is running under another debugger, for instance, a process which is running under Microsoft Visual Studio.
If you attach to a .NET or Java application, AQTime will not analyze managed code in this application; only unmanaged code will be profiled. For example, by attaching a profiler to a managed application, you can profile native-code DLLs used by that application.
Due to technical limitations of Windows Server 2003, AQTime cannot attach to a process that is launched under another user account. This operating system does not allow creating remote threads in a terminal session that differs from the current session, and thus AQTime cannot inject its modules into the process to be profiled. Consider launching both processes under the same user account, or profiling under another operating system (Windows Vista, Windows Server 2008 or later).
Profiling with the “Attach to Process” feature does not differ much from ordinary profiling. Below is a step-by-step explanation of how to profile an executable using this feature:
Compile the application with the debug information (see Preparing Applications for Profiling).
Open the application in AQTime.
Select Normal from the Profiling Mode dropdown list box on AQTime’s Standard toolbar.Select Normal from the Profiling Mode dropdown list box on Visual Studio’s AQTime toolbar.Click the Normal button on RAD Studio’s AQTime Profiling Modes toolbar. This is necessary because the Attach to Process feature only works in the Normal mode.
Select the desired profiler.
Run the application outside AQTime.
Select Run > Attach to Process from the main menu or press Attach to Process button on the Standard toolbar. (If the selected profiler does not support the “Attach to Process” feature, this button is disabled). Upon pressing the button, the following dialog will appear:Select AQTime > Attach from Visual Studio’s main menu. (If the selected profiler does not support the “Attach to Process” feature, this item is disabled). Upon selecting the item, the following dialog will appear:Click the Attach to Process button in RAD Studio. (If the selected profiler does not support the “Attach to Process” feature, this button is disabled). Note that this button does not reside on any toolbar by default. However, you can add the button to any RAD Studio’s toolbar via the Toolbar Customization dialog. In this dialog, switch to the Commands page, select the Run.AQtime category in the Categories list, drag the Attach to Process command from the Commands list and drop it on the needed toolbar. Upon clicking the button, the following dialog will appear:
The dialog holds a list of all of the processes that exist in the operating system at the moment. By default, system processes are hidden. To make them visible, check the Show system processes box. For instance, if you are profiling an IIS application (IIS applications are DLLs), you should check this box, because normally the IIS process is running under the system account.
Note once again that AQTime cannot attach to a process that is running under a debugger. Such processes are grayed out in the dialog. The explanation why AQTime cannot attach to a process is shown in the Information column of the dialog.
If you are profiling a dynamic link library, you should attach to the process that uses it. To attach to the desired process, select it in the list and press OK.
If you attach to a managed process, AQTime will display a message informing you that managed code will not be profiled (see the note about this above). The reason for attaching in this case is to profile unmanaged DLL(s) loaded by that managed process.
If the desired process is not running, you should start it, then return to the dialog and press the Refresh button or F5 on the keyboard to update the process list. When the process is displayed in the list, you can attach to it. The Cancel button will cancel profiling.
Upon pressing OK, AQTime injects its DLL into the process address space and then starts instrumenting the profiled module. If the profiler’s option Show uninstrumented routines > In the dialog is on, then AQTime displays the Uninstrumented Routines Dialog explaining why certain routines cannot be profiled. To start profiling, press OK in the dialog.
Now you can profile the application as your needs dictate.
The profiling starts after the instrumentation finishes.
Important: all calls to functions (lines) that occurred before instrumentation will not be profiled and will not be included in the profiling results. For instance, a trigger will not affect profiling, if it is started while this trigger is running. In addition, a routine that was called before or during the profiling start will not be shown in the Parent and Children tables of the Details panel.
Note: In 64-bit versions of Windows, 32-bit modules can be loaded into 32-bit processes only and 64-bit modules can be loaded into 64-bit processes only. So, if the “bitness” of your module does not match the “bitness” of the process, to which the module is loaded, AQTime will not start profiling.
|To obtain the profiler results, select Run > Get Results from AQTime’s main menu.select AQTime > Get Results from Visual Studio’s main menu.select AQTime > Get Results from RAD Studio’s main menu. An alternative way to obtain profiling results is to create an action for this. See Getting Results During Profiling for more information. Results are also generated when the process, to which you attached, finishes.|