Triggers are an AQtime facility allowing for better control of profiling under the Performance, Coverage and Function Trace profilers. The purpose of triggers is to allow profiling to come on when certain routines (on-triggers, see below) are executing (including during their calls to “child” routines), or on the contrary to be turned off (off-triggers, see below). Do not confuse triggers with areas, the purpose of using them differs. With areas and checking, you set what you never want profiled during the current run (that is, everything but the checked elements). With triggers and Initial Status, you set in what part of the execution path you want to enable profiling, or to disable it.
The list of triggers are defined in the Triggers and Actions pane of the Setup panel and include three linked settings: on-triggers, off-triggers and Initial profiling status for Threads.
Initial Profiling Status for Threads is one default trigger displayed at the top of the Triggers list. It sets the profiling status at the beginning of threads, before any other triggers click it (after that, it has no effect). Initial profiling status can be set on (profiling allowed until an off-trigger operates) or off (no profiling until an on-trigger operates).
Other triggers in the list are collections of potential trigger routines of one type, either on- or off-.
Besides the trigger type, you can also specify additional options for triggers:
For more information on how to create triggers and how to set their options, see Creating, Editing and Deleting Triggers.
No triggers operate at all unless at least one collection is checked. And in the collection only those triggers operate which are checked also. The mechanism of enabling/disabling actions is identical to that of checking areas' elements. For details, see Checking Elements to Profile.
Some notes about triggers:
For any given thread, at any given moment, profiling status is “enabled” or “disabled”. Profiling actually operates in a thread if, one, status for that thread is “enabled” and, two, nothing else excludes the current routine from profiling.
The Enable/Disable Profiling buttonThe AQtime > Enable/Disable Profiling menu itemThe AQtime > Enable/Disable Profiling menu item is an onscreen way of controlling profiling status by hand while the application runs. If it is pressed-in (), profiling status is as set otherwise. When you unclick it (), profiling is turned off for all threads. When you press it back in, you re-enable profiling, according to whatever is otherwise set for the application at that point (not as it was when you disabled it).
If there are triggers of any kind, the Initial Profiling Status for Threads option specifies whether the profiling on or off on the creation of each new thread. In other words, Initial Profiling Status defines whether profiling is enabled or not before any trigger in a thread starts executing. After that, it has no effect. Likewise if there are no triggers at all.
When an on-trigger routine begins executing, it saves the current profiling status for its thread and enables profiling for that thread. This still applies to everything it calls. When it reaches the end of its execution (after perhaps hundreds of calls, sub-calls and sub-sub-calls), it restores the thread’s profiling status as it found it.
When an off-trigger routine begins executing, it saves the current profiling status for its thread and turns profiling off for that thread. When it reaches the end of its execution, it restores the thread’s profiling status as it found it.
Proc_B is an off-trigger routine, profiling is currently enabled and either All Project Modules (Routines only) or All Project Modules (Collect info about lines) is used:
Proc_B // off-trigger routine
Proc_D; // Proc_D and Proc_E are child routines of Proc_B,
Proc_E; // that is, they are called within Proc_B.
// Proc_D and Proc_E are not profiled.
As profiling is enabled and All Project Modules is on, AQtime profiles
Proc_A. When the application enters
Proc_B, profiling is disabled for that thread. So
Proc_E are not profiled. When
Proc_B exits, AQtime restores the profiling status as it was -- enabled -- so
Proc_C is profiled.