Applies to AQtime 8.71, last modified on December 5, 2018

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:

Watch Video

See how the “Attach-to-Process” feature works:

AQtime: Attaching to Process

Important notes:

  • 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:

  1. Compile the application with the debug information (see Preparing Applications for Profiling).

  2. Open the application in AQtime.

  3. Switch to the Setup panel and select areas and triggers for profiling (see Choosing What to Profile and When).

  4. 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.

  5. Select the desired profiler.

  6. Run the application outside AQtime.

  7. 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:

    Select Process to Attach Dialog
  8. 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.

  9. 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 AQtime > Get Results from Visual Studio’s main 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.

See Also

Running a Profiling Session
Starting and Stopping Profiling

Highlight search results