Profiling Multiple Applications Simultaneously With AQtime

  February 21, 2007
Most people who use AQtime don’t realize that it can be used to profile multiple
applications running at the same time. When you need to measure the performance or profile the
memory usage of several programs simultaneously then you just run a
separate instance of AQtime for each program you analyze.

Why would you need to profile more than one application at the same time?

In a complex setup, you may not be able to guess which application is
causing a performance issue. For example, you may have a performance problem
in a payroll process which calculates the payroll and taxes for 10,000 employees,
prints paystubs and connects to online services to coordinate direct deposits.
Your payroll process may have several applications that work together to
accomplish these tasks, one application to calculate salary and taxes
which calls another application to print the pay stubs and then calls
another program to handle the direct deposits.

Or you may just want to check code coverage in each application for the
same scenario.

Either way, you’ll want to set up your test so that you configure and
run a new instance of AQtime for each application that you are tracking.

For each process you are going to profile, you just:

  • Create a project
  • Add the desired modules to it
  • Specify the profiling areas, triggers, actions and other settings
  • Then start the process from a unique AQtime instance
  • OR attach to the already running process from a unique AQtime instance using the Attach-to-Process feature.

If it's important that you start analyzing your application immediately when it starts so you can analyze the startup code, then you'll want to use AQtime to start the process since the Attach-to-Process feature requires a little time to connect to a running application.

In the payroll scenario described above, it wouldn't be easy to use AQtime to start each process since the applications are starting each other from inside their code.

To solve this type of problem, you can modify the registry to tell Windows that AQtime is the debugger for your application so that AQtime will be launched anytime the operating system receives the command to launch your application.

Then when Windows gets the command to start your application, it will automatically launch an AQtime instance, which you can then use to profile your application.

To modify the registry settings to use AQtime as a debugger for your app every time it launches:

  • Launch the Registry Editor (regedit).
  • Open the HKEY_LOCAL_MACHINESoftwareMicrosoftWindows NTCurrentVersionImage File Execution Options node.
  • Add a key for your application to this node:
    • Right-click the node and choose New | Key from the context menu. This will create a new key node under the Image File Execution Options node.
    • Right-click the new node and select Rename from the context menu.
    • Change the key name to the name of your executable (for instance, MyApplication.exe). Only specify the file name and extension. The path is not needed.
  • Specify AQtime as a debugger for the application. To do this:
    • Right-click the new key node and select New | String Value from the context menu. This will append a new string value to the created key.
    • Switch to the right panel of the Registry Editor, right-click the string value's node and choose Rename from the context menu.
    • In the ensuing in-place editor, change the value name to debugger.
    • Right-click the value node again and select Modify from the context menu. This will call the Edit String dialog.
    • In the Value data box of the dialog, enter the fully qualified name of AQtime.exe, for instance, C:Program FilesAutomated QAAQtime 5BinAQtime.exe.
    • Click OK to save the changes and to close the dialog.

Now the operating system will launch AQtime every time your application starts.

Do not forget to remove the registry key when you no longer need to
automatically start AQtime.

If you need to enable or disable the automatic launch frequently, you can create two .reg files:

  • One of the files will include the Registry key and the debugger value with
    the path to AQtime:

    To create this file:

    • Modify the registry as it was described above.
    • Select the key in in the tree view on the left of the Registry Editor.
    • Choose File | Export from the editor's main menu and specify the file name in the ensuing Export Registry File dialog.
  • Another file will store the Registry key and the debugger value, but it will not store the path to AQtime:

    Click to display image

    To create this file:

    • Modify the registry as it was described above.
    • Clear the data of the debugger value.
    • Export the key to a file by choosing File | Export from the main menu of the Registry Editor.

Now, when you need to enable or disable the automatic launch of AQtime for your application, you can execute one of the .reg files.