![]() |
![]() |
![]() |
![]() |
![]() |
Tracing the Execution
When the SDL system is executing during simulation, you can obtain trace information of the execution. This makes it easier to follow the events that happen during execution.
There are three types of execution traces:
- Textual Trace, printed in the Simulator UI's text area, or on the terminal (in stand-alone mode)
- GR Trace, graphically illustrated by selecting SDL symbols in an SDL Editor
- MSC Trace and Logging, illustrated by drawing MSC events in an MSC Editor, or by saving the MSC events to a log file.
The amount of trace is determined by a trace value for each of the three trace types. The trace value controls the level of detail in the trace; the trace value 0 (zero) means no trace. Setting appropriate trace levels is often something you would like to do before the execution is started.
Apart from these continuous trace functions, there are also other possibilities to trace the execution. See Other Tracing Functions.
Specifying Unit Names
Trace values can be assigned to different units of the SDL system; the system as a whole, blocks, process types, and process instances.
- When using the Simulator UI, you will be presented with a list of all units in the system, from which you may select the appropriate unit.
- When running the simulator stand-alone, you have to specify a unit, unless you want to set the trace for the system. In the trace commands described below, you may abbreviate the name of the unit. However, if several units match a unit name, the first unit found from the system level will be used. To make sure the correct unit is specified, the name can be prefixed with the diagram type or a qualifier.
Example 339 : Specifying Trace Unit Names
System DemongameBlock GameBlockProcess GameIn this diagram structure, the unit name "Game" would refer to the block GameBlock. To specify the process Game instead, the unit could be expressed as "process Game" or "<<System Demongame / Block GameBlock>> Game".
Determining the Scope of Trace
When a process instance executes a transition, or part of a transition, the trace value for the instance is found using the following algorithm:
- If a trace value is defined for the process instance executing the transition, that value is used.
- If not, and a trace value is defined for the process type, that value is used.
- Otherwise, if a trace value is defined for the block enclosing the process, that value is used.
- If still no trace value is found, the block structure is followed outwards until a unit is reached which has a trace value defined. The system always has a trace value defined.
For MSC trace the situation is slightly more complex; see MSC Trace.
Textual Trace
Textual trace is printed for the transition or the SDL symbols that were last executed.
To quickly set the maximum textual trace level (6) for the system, click the TEXT button in the Trace module.
The general procedure to set the trace value for textual trace is:
- Choose Text Level : Set in the Trace menu, or enter the command Set-Trace. The command takes two parameters, an optional unit name and the trace value.
- Select or enter the name of the unit to set the trace for. If you do not specify a unit name, or the default name `-' is entered, the trace will be set for the whole system.
- Select or enter a trace value between 0 and 6. The trace values are shortly described in the dialog, or after hitting <Return> in stand-alone mode. The following table explains them in more detail; for a full explanation, see Trace Limit Table. The default textual trace value is 4 for the system.
To list the textual trace values that are defined for the units in the system, choose Trace Level : Show in the Trace menu, or enter the command List-Trace-Values.
You can also reset the trace value for textual trace for a unit, i.e., set it to undefined. To do this, enter the command Reset-Trace and specify a unit (there is no button for this command).
GR Trace
GR trace will open an SDL Editor and continuously select the next SDL symbol to be executed in the corresponding process diagram. (See also Tracing Simulations (Graphical Trace).)
To quickly set the GR trace level for the system to 1 (see below), click the SDL button in the Trace module.
The general procedure to set the trace value for GR trace is:
- Choose SDL Level : Set in the Trace menu, or enter the command Set-GR-Trace. The command takes two parameters, an optional unit name and the trace value.
- Select or enter the name of the unit to set the trace for. If you do not specify a unit name, or the default name `-' is entered, the trace will be set for the whole system.
- Select or enter a trace value between 0 and 2. The trace values are shortly described in the dialog, or after hitting <Return> in stand-alone mode. The following table explains them in more detail. The default GR trace value is 0 for the system.
To list the GR trace values that are defined for the units in the system, choose SDL Level : Show in the Trace menu, or enter the command List-GR-Trace-Values.
You can also reset the trace value for GR trace for a unit, i.e., set it to undefined. To do this, enter the command Reset-GR-Trace and specify a unit (there is no button for this command).
MSC Trace and Logging
MSC trace will enable transformation of the SDL events that take place during execution into corresponding MSC events. Of course, not all SDL events are possible to transform into MSC events; typically, the events that can be transformed are sending and consumption of signals, setting and expiration of timers, and creation and termination of processes. By default, this transformation is enabled for the whole system.
The MSC events that are created by MSC trace can then be logged in two different ways:
- by opening an MSC Editor and continuously adding the events to an MSC diagram created for this purpose, or
- by continuously saving the events to a log file that later can be opened from an MSC Editor.
Therefore, setting the MSC trace value does not start the actual logging of MSC events in an MSC Editor or on file.
MSC Trace
To set the trace value for MSC trace:
- Choose MSC Level : Set in the Trace menu, or enter the command Set-MSC-Trace. The command takes two parameters, an optional unit name and the trace value.
- Select or enter the name of the unit to set the trace for. If you do not specify a unit name, or the default name `-' is entered, the trace will be set for the whole system.
- Select or enter a trace value between 0 and 3. The trace values are shortly described in the dialog, or after hitting <Return> in stand-alone mode. The following table explains them in more detail; for a full explanation, see Message Sequence Chart Traces. The default MSC trace value is 1 for the system.
To list the MSC trace values that are defined for the units in the system, choose MSC Level : Show in the Trace menu, or enter the command List-MSC-Trace-Values.
You can also reset the trace value for MSC trace for a unit, i.e., set it to undefined. To do this, enter the command Reset-MSC-Trace and specify a unit (there is no button for this command).
Logging of MSC Events
To start the continuous logging of MSC events in an MSC Editor:
- Choose MSC Trace : Start in the Trace menu, or enter the command Start-Interactive-MSC-Log. The command takes one parameter, a symbol level determining the amount of information that should be part of the MSC.
- Select or enter a symbol level between 0 and 2 (see the table below).
- An MSC Editor is opened and the execution is then traced by adding MSC events to the created diagram. (See also Tracing a Simulation in a Message Sequence Chart.)
To quickly start the continuous logging of MSC events in an MSC Editor with symbol level 1, click the MSC button in the Trace module.
To start the continuous logging of MSC events in a log file:
- Choose MSC Trace : Start Batch in the Trace menu, or enter the command Start-Batch-MSC-Log. The command takes two parameters, a symbol level and the name of the log file. The symbol level determines the amount of information that should be logged.
- Select or enter a symbol level between 0 and 2 (see the table below).
- Select or enter a log file name, preferably with the suffix .mpr.
When an MSC log is started, the amount of information that should be part of the log can be decided by giving the symbol level parameter an appropriate value, according to the table below:
Note that you cannot have both types off logging enabled at the same time. To see what type of logging is enabled, enter the command List-MSC-Log (this command has no button).
To stop the logging, choose MSC Trace : Stop in the Trace menu, or enter the command Stop-MSC-Log. If you used logging to an MSC Editor, you should then save the trace from the editor. If you used logging to file, the file is automatically saved and closed.
Other Tracing Functions
Showing SDL Symbols
If you do not have GR trace enabled, it is still possible to show the next symbol to be executed in an SDL Editor. To do this, choose
Next Symbol in the Show menu, or enter the command Show-Next-Symbol.In a similar fashion, the last executed symbol can be shown in an SDL Editor. This will give you a correspondence between textual trace and the SDL Editor, since textual trace always is printed for the last executed symbols. To do this, choose Prev Symbol in the Show menu, or enter the command Show-Previous-Symbol.
Tracing Back to C Code
A trace-back to the generated C source code for the system is also possible. To show where in the C code the execution is at the moment, choose C Line in the Show menu, or enter the command Show-C-Line-Number. The file name and line number of the C source file is printed, and the C source file is opened in the Text Editor, positioned on the correct line.
Generating Coverage Information
To see how much of the SDL system you have covered during simulation, you can open the coverage information in a Coverage Viewer, and for instance examine which parts of the system that have not been executed during the simulation. To start the Coverage Viewer, choose Coverage in the Show menu, or enter the command Show-Coverage-Viewer.
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |