Profiling DLLs That Can Be Loaded in Various Processes

Applies to AQTime 8.81, last modified on January 18, 2022

When you profile an ordinary application, AQTime behaves as a debugger relative to the profiled application’s process. When you launch your application under any AQTime profiler, AQTime loads the corresponding process in memory and collects information about function calls during profiling.

When you use AQTime to profile DLLs, AQTime behaves as a debugger relative to the host application that corresponds to the tested DLL. It detects when the DLL is loaded in the host application’s process and then retrieves all the needed information from this process. For more information, see Profiling Dynamic Link Libraries.

One more typical situation is when AQTime cannot launch the profiled application or a DLL’s host application. In this case, you can attach to the corresponding process directly from AQTime. For more information on attaching to processes from AQTime, see Attaching to Process.

Besides the applications mentioned above, you may also need to profile DDLs that can be loaded in various processes and it is not known beforehand in which process the profiled module will be loaded. So, you will not be able to add the process’s executable to the list of monitored applications, and thus AQTime will fail to obtain the needed information when the process loads the profiled DLL. The typical examples of such DLLs are hooks. These modules are usually loaded in one or several processes simultaneously and the names of these processes are not known beforehand.

AQTime allows you to profile such DLLs with the Light Coverage profiler. Currently, other AQTime profilers do not allow profiling the mentioned DLLs.

To profile DLLs that can be loaded in various processes, use AQTime's Profile code in any process option. This option switches AQTime to the profiling mode used for the described DLLs. So, the general procedure of profiling such DLLs with AQTime includes the following steps:

  1. Add the DLL you want to profile to the Modules pane. For more information, see Selecting Applications and Modules to Profile.

    Note: You just need to add the DLL module to your AQTime project. There is no need to add the host application’s executable or other modules to the project.
  2. Select the Light Coverage profiler from the drop-down list on the Standard toolbarfrom the Profiler drop-down list in the AQTime menuthe Current Profiler submenu of the AQTime menu.

  3. Open the Light Coverage Profiler Options dialog and select the Profile code -- in any process option.

  4. Start profiling.

    Now, AQTime will do the following:

    • Search for the profiled module, modifies its source so that it automatically collects the needed information from the moment it is loaded.
    • The original version of the module is not deleted from the disk. AQTime just renames and saves it in the same folder where it was located.
    • After that, you need to run the application that will load the profiled module. The module will start collecting profiling information and then pass it to AQTime after the profiling is terminated.
  5. To generate profiling results, use the Run > Get Results option from AQTime’s main menuselect the AQTime > Get Results option from Visual Studio’s main menuselect AQTime > Get Results from RAD Studio’s main menu.

  6. To stop profiling, click the Terminate button on the Standard Terminate on the AQTime AQTime > Terminate from RAD Studio’s main menu.

    Right after AQTime receives all needed information, it deletes the modified module from the disk and restores the original version of the file under the initial name.

  7. After the profiling is over, AQTime automatically shows the Report panel that contains the profiling results. For more information on the data shown in this panel, see Light Coverage Profiler - Report Panel.

See Also

Profiling Various Applications and Code
Profiling Dynamic Link Libraries
Controlling What to Profile
Light Coverage Profiler - Overview
Light Coverage Profiler Options

Highlight search results