Adding Code to Areas

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

Using areas, you can specify code portions (routines, classes, modules) to be profiled or specify routines to be included in the stack data collected by AQTime profiles. The following sections describe how you can add an element to an area:

Adding Code to Areas

You can add code to areas in several ways:

  • The easiest way to do this is to drag the needed elements from the Modules pane of the Setup panel to the target pane (Classes to Profile, Code to Profile or Collect Stack Information). To do this, follow the steps below:

    • In the Modules pane, select the element to be added to the area.

      The Modules pane displays a tree view of the entire application, any part of which you can expand or collapse. You can make a single or multiple selection in the view using click, Shift-and-drag or Ctrl-click. For example, you can select the entire namespace, then unselect parts of it by Ctrl-clicking them off.

    • Drag the selected element from the tree view and drop it onto the target area in the desired pane.

  • Another way is to right-click any of the selected elements in the Modules pane and choose Add Selected to Area > <Area name> or Add Selected to Area > Add to New Area from the context menu.

    Note: Depending on the selected profiler, the mentioned context menu item is called either Add Selected to Class-Level Area, Add Selected to Profiling Area or Add Selected to Stack Area.

    When you select the Add to New Area submenu item, you are offered to create a new area by using the Add Area dialog. Once the dialog is closed, AQTime creates the new area and adds the selected elements to it.

  • Profiling under Visual Studio provides the ability to add elements to the area directly from the Code Editor. AQTime adds the Profile submenu to the editor’s context menu. The Profile submenu has the following items:

    • Profile <routine name> Routine - Starts profiling a routine under the cursor.
    • Profile <class name> Class - Starts profiling a class where the cursor is located in the code.
    • Profile <file name> File - Starts profiling a source file displayed in the code editor.

    When any of those items is chosen, AQTime creates or redefines the line area named Quick profiling area and adds the chosen element to the profiling list and immediately runs the selected profiler.

  • Profiling under RAD Studio provides the ability to add elements to the area directly from the Code Editor. AQTime adds the Profile submenu to the editor’s context menu. The Profile submenu has the following items:

    • Profile <routine name> Routine - Starts profiling a routine under the cursor.
    • Profile <class name> Class - Starts profiling a class where the cursor is located in the code.
    • Profile <file name> File - Starts profiling a source file displayed in the code editor.

    When any of those items is chosen, AQTime creates or redefines the line area named Quick profiling area, adds the chosen element to the profiling list and immediately runs the selected profiler.

  • You can also add routines and classes to areas from the Report panel. To learn how to do this, see Adding Selected Routines and Classes to Profiling Areas, Triggers and Actions.

Removing Code From Areas

You can remove elements from any custom area at any time. You can do this in one of the following ways:

  • Right-click the desired element and select Remove from the context menu.
  • Select the desired element and press Delete.
  • Drag the desired element from the area and drop it onto the Modules pane.
  • Uncheck the elements you wish to remove and then use the Remove Unchecked Elements context menu item.
  • Check only the elements to be removed and use Remove Checked Elements.

AQTime will display a message asking you if you want to delete the selected items. Click Yes to delete them, or No to cancel the deletion.

Tip: You can also remove an element from an area by dragging and dropping it onto another area.

Important Notes

  • If you add a module, source file or class to a profiling area, all the routines in this module, source file or class will be profiled at the appropriate level (or they will be excluded from profiling). If you add a module, source file or class to a stack area, AQTime will include all the routines of this module, source file or class in a call stack (or exclude all the routines from it). If you add a module or source file to a class-level area, AQTime will profile all the classes of this module.

  • It is possible that the same source file is duplicated in different modules. For example, if routines of a header file are included in different units, then the file will be included into each of these classes with appropriate routines. When you add such files into an area, keep in mind that each instance may contain different set of routines, so you have to add each of them individually.

  • Routines that belong to triggers or actions are treated as routines that are added to a profiling area. They are profiled even if they belong to an excluding area. For more information, see About Actions and About Triggers.

  • The Setup panel does not display classes that neither introduce new methods, not override existing ones. This may happen even if a class introduces a new method, but this method is not called in the application code: the compiler may not include the method in the application’s binary code during optimization. However, profiling of such classes is possible if you enable the All Project Modules option. AQTime will profile the methods of the ancestor class. For more information on profiling such classes with the Allocation profiler, see a note in the Allocation Profiler topic.

  • Some part of routine execution time can be spent on calling other routines, which we call “child” routines (it’s the calls that are child calls, actually). If the child routines are not part of an including profiling area, you will not be able to narrow down your profiling to find bottlenecks outside the main routine. Profiling results can discriminate between a routine’s own execution time and its overall execution time, “with children”. If you want to know about the children themselves, add them to an including profiling area. See Profiling Child Routines Along With Parents.

  • Remember that you do not have to use an area as-is. The point of adding or removing elements is to create a “stored definition”, which you can later trim simply by unchecking elements. It is perfectly reasonable to run a profiler on an entire area, then begin unchecking elements for each successive run, as you eliminate the uninteresting parts. See Checking Elements to Profile.

  • AQTime stores the area settings in the project file (.aqt).

See Also

Using Areas
About Areas
Checking Elements to Profile
Adding Code to Profiling Areas From Code Editor

Highlight search results