Before Starting the Profiling
Besides the main preliminary steps (such as creating a project, specifying what to profile or selecting a profiler), there are a few more checks to go through before starting the run:
-
Check that you have set the running conditions as they need to be. For an EXE, these are the (possible) runtime arguments, for a DLL, the (necessary) host application. Most of the time, you do not have to do anything, because you are testing an exe that takes no parameters, or because you simply want to keep the existing settings. To check or change conditions, use Run > Parameters from the main menu.To check or change conditions, use AQTime > Parameters from Visual Studio’s menu.To check or change conditions, use AQTime > Parameters from RAD Studio’s menu. This leads you to the Run Parameters dialog, which has a box both for parameters and for host application. See Profiling Dynamic Link Libraries for details on the latter.
-
Make sure that the necessary modules (for example, DLLs) can be loaded.
-
Specify the type of profiled executable using the Profiling Mode drop-down list box on AQTime’s Standard toolbar. This list includes the following items:the Profiling Mode drop-down list box on Visual Studio’s AQTime toolbar. This list includes the following items:the AQTime Profiling Modes toolbar in Embarcadero RAD Studio. This toolbar includes the following items:
Normal - Means that the profiled executable is a regular managed or unmanaged executable or library. This item is selected by default.
ASP.NET - Means that the profiled executable is an ASP.NET application or .NET Web service. To profile a Windows service, select Service profiling. For more information on how to profile ASP.NET applications, see Profiling ASP.NET Applications.
IIS - Means that the profiled executable is an IIS application or Web service created with an unmanaged compiler. For more information on profiling such applications, see Profiling IIS Applications.
COM Server - Means the profiled executable is a COM application. For more information, see Profiling COM Applications.
Service- Means that the profiled executable is a Windows service. Do not use it for ASP.NET service profiling. For more information on how to profile services, see Profiling Services.
-
Make sure that the Enable/Disable Profiling button on the Standard toolbar is in its normal pressed-in state (as shown), unless you want to start with profiling turned off, overriding your trigger and action settings.
-
If you are using the Performance or Function Trace profiler and your computer’s CPU (for instance, Intel Pentium M) supports dynamic CPU frequency mode, you should disable the dynamic change of the CPU frequency in order to obtain accurate results. If the CPU frequency is changed dynamically, the timing results may be inaccurate.
-
If you are using the Allocation profiler, make sure that you have checked one or more class-level areas. Otherwise, you may receive empty results. This typically concerns profiling of .NET applications and the reason for this is quite simple: the profiler always tracks memory-block allocations done by non-class memory management routines such as
new
oralloc
. Therefore, if you start profiling a .NET application and there are no class-level areas selected, the profiler will not notify you, since that .NET application may include unmanaged sections of code and these sections may call non-class memory management routines, which you may want to profile.
Two notes:
-
If you use a computer that has several processors or a multiple-core processor (for example, dual-core CPU) and has Windows XP Service Pack 2, then you must install the Windows update #896256 in order for AQTime to be able to profile your application correctly. The update is available on Microsoft’s web site:
-
In order for AQTime to be able to profile your application, the user account, under which AQTime will be running, must have administrator permissions. The easiest way to grant these permissions is to add this account to the Administrators group.
Starting the Profiler Run
To start profiling, press Run on the Standard toolbar or select Run > Run from AQTime’s main menu.
To start profiling, select AQTime > Run from Visual Studio’s main menu.
An alternative way to start profiling is to press Visual Studio’s Run button or selecting Debug > Run menu item while one of AQTime’s panels is active or while an AQTime panel is selected in the Solution Explorer.
Note: | Depending on the current project and solution configuration the Debug > Run menu item and corresponding Run button can be renamed to Debug > Start Debugging and Start Debugging. |
To start profiling, select AQTime > Run With Profiling from RAD Studio’s main menu.
An alternative way to start profiling is to press RAD Studio’s Run button on the Debug toolbar or select the Run > Run menu item while one of AQTime’s panels is active or while an AQTime panel is selected in the Project Manager.
After you selected RunRunAQTime > Run With Profiling, AQTime displays the Profiler Options dialog where you can check or modify profiling options and conditions for the coming profiler run. AQTime will start profiling after you close the dialog.
x64 editions of the Windows operating system require that the “bitness” of a process and the module that is loaded into this process be the same (in other words, 32-bit modules can be loaded only into a 32-bit process and 64-bit modules can be loaded only into a 64-bit process). This limitation may exist when profiling a dynamic link library, an in-process COM server or any other module that is loaded into a process. If the “bitness” of the module and process is not the same, AQTime will stop profiling and display an error message informing you about the problem. |
Some points while executing the application:
-
Run the operations that you need to profile (for instance, those where you suspect a bottleneck). You might plan your run before starting, to be sure you hit all the high (or rather, low) points.
-
You can use the Enable/Disable Profiling buttonthe AQTime > Enable/Disable Profiling menu itemthe AQTime > Enable/Disable Profiling menu item to suspend profiling, but not execution, while you run through parts of the application you do not need to profile. See Choosing What to Profile and When for the caveat.
-
AQTime generates results when the application execution is over. To obtain profiling results during the run, select Get Results from the Run menu or from the Standard toolbar select AQTime > Get Results from Visual Studio’s main menu select AQTime > Get Results from RAD Studio’s main menu. You may also need to use this item if the profiling process never ends. See Getting Results During Profiling for more information.
-
If you profile a managed application, you can click Force Garbage Collectionselect AQTime > Force Garbage Collectionclick the Force Garbage Collection button to initiate garbage collecting in the profiled process. You may do this, for instance, to see which objects will be removed and which will remain in memory. Note that the Force Garbage Collection 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 Force Garbage Collection command from the Commands list and drop it on the needed toolbar.
-
If you want to force the application process to end, click Terminate select AQTime > Terminate select AQTime > Terminate. You may need to do this if the application cannot normally be ended without rebooting, logging off or some other drastic intervention, or if it simply stopped responding. Pressing Terminate does not generate profiling results.
-
Some profilers, with some over-enthusiastic settings, may slow application execution to the point where you mistake it for a crash.
-
Once you have gone through the operations you wanted, exit the application. Do not accumulate needless profile data.
If this has happened, you can flush all gathered results. To do this, select Clear Results from the Run menu, or from the Standard toolbarselect AQTime > Clear Results from Visual Studio’s main menuselect AQTime > Clear Results from RAD Studio’s main menu (see Clearing Results During Profiling).
Once you exit, the resultant profile will be displayed in AQTime’s Report panel.