![]() |
![]() |
![]() |
![]() |
![]() |
Using Different Trace Values
The amount of trace information printed during transitions is set by the command Set-Trace. So far, you have used this command to set the trace value to 6. The higher the trace value you set, the more information is printed.
You can also define trace values for different parts of the system. In this way, blocks, process types, process instances, etc. can have different trace values. If a process does not have a trace value defined, the value for the enclosing block is used. If the block does not have a defined value, the value for the next enclosing structure is used, etc. The system always have a trace value defined, which initially is 4.
In this exercise, you will use these facilities to run the demon game and only print trace information for transitions executed by the processes Main and Game. The process Demon will not be traced. This is accomplished by setting the trace value for the system to 0 and the value for the block GameBlock to 6.
The GR trace value will be set to 1 throughout this exercise.
What You Will Learn
- To set trace values for different parts of a system
- To list the current trace values
- To execute the next SDL symbol only
- To execute a sequence of transitions until trace is printed
Setting Trace Values
The command Set-Trace actually takes two parameters, the name of a unit and a trace value, and assigns the trace value to the unit. To easily specify the unit, you will now execute Set-Trace by using a menu, instead of entering it on the input line.
- First, restart the simulator. If needed, resize and move the SDL Editor window that is open.
- Locate the Trace menu and select the Text Level : Set entry. In the first dialog, select the unit System Demongame and click OK. In the second dialog, select the trace value 0. Note that all possible trace values (0-6) have a short explanation.
- In a similar way, set the trace value for the block GameBlock to 6.
- The menu choice SDL Level : Set can be used to set the GR trace value in the same way. Use it to set the trace value for the system DemonGame to 1.
- Check that you have set the correct trace values by using the menu choices Text Level : Show and then SDL Level : Show. The following information should be printed:
Default 4 = All SDL actionsSystem Demongame : 0 = No traceBlock GameBlock : 6 = All SDL actions + Result + ParametersDefault 0 = GR trace offSystem Demongame 1 = Show next symbol when entering monitorExecuting Symbol by Symbol
To clearly see that the Demon process is not traced in the text area, we will follow the execution in smaller steps than complete transitions. The smallest execution step possible is one SDL symbol at a time. The command Step-Symbol is used for this.
- First, send the Newgame signal from the environment.
- Execute the start symbol of Main by clicking the button Symbol (in the Execute module). Note that the printed trace does not include information about the next state (Game_Off) since that symbol has not yet been executed (it is selected to be executed next):
*** TRANSITION START* PId : Main:1* State : start state* Now : 0.0000- Execute the next symbol with the Symbol button. Now, the printed trace gives information about the Game_Off state being reached:
*** NEXTSTATE Game_Off- The execution now continues in the Demon process. Execute the three symbols in the start transition of Demon. Note that no trace is printed in the text area, since Demon is not part of the block GameBlock.
- Continue executing the symbols in the Main and Game processes until the Demon process is entered again (you will need to press the Symbol button a number of times; watch the SDL Editor window for monitoring the execution). Note that trace is printed for each symbol.
- When the Demon process is entered, you can continue to execute symbol by symbol, or you may execute the complete transition by using the Transition button as usual. No trace is printed.
- Stop executing when you are back in the Game process.
Hiding Uninteresting Transitions
If you would continue to execute transition by transition at this point, trace would only be printed while executing the Game process. But, you would still have to manually execute the "silent" transitions in the Demon process. To avoid this, you can use another command,
Next-Visible-Transition. This command executes a sequence of transitions; it stops after it has reached a process with a trace value greater than 0, i.e., when the first "visible" transition is executed. In this way, transitions by uninteresting parts of the system are hidden.
- Execute the command by choosing Until Trace in the Execute menu. The execution does not stop until the Game process is entered again and the state Winning (or Losing) is reached. Trace is then printed for the last executed transition.
- Repeat the command a number of times. The printed trace shows that you are now switching between the states Losing and Winning in the Game process. The execution in the Demon process is hidden in the printed trace.
- You should note, however, that the GR trace only shows the Demon process. Remember that the GR trace selects the next symbol to be executed, which is always in the Demon process when the Game process has reached the state Winning or Losing. If you want to check where in the Game process you are, do as follows:
- Choose Prev Symbol in the Show menu to select the last executed symbol. This should be a state symbol, Winning or Losing, in the Game process.
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |