IBM
Contents Index Previous Next



Viewing the Internal Status


In this exercise we will introduce some of the available commands for viewing the internal status of the system. With the graphical user interface, it is also possible to continuously view the internal status without having to execute commands manually.

In the previous exercise, you learned how to interpret the available traces. We will not focus on these details anymore, unless we need to point out some important aspect.

What You Will Learn

Restarting the Simulator

Before continuing, you need to restart the simulation from the beginning and set the trace level:

  1. Select the Restart command from the File menu.
  2. A dialog informs you that the current simulation will terminate. Confirm this by clicking OK. The text area is cleared and the simulator is now reset.
  3. Set the trace level to 6 and the GR trace level to 1, as before. The easiest way to do this is to use the up arrow key on the input line to find the previous Set-Trace 6 and Set-GR-Trace 1 commands and then hit <Return>.
    • The Simulator UI remembers all previous commands entered on the input line in the same session, even if you have started a new simulator.

Viewing Process and Signal Queues

To view the internal status continuously, the Command window is used. This window shows, if your preferences are set up adequately, the process ready queue and a list of all processes.

This information is displayed in separate "modules" in the Command window by executing suitable monitor commands (List-Ready-Queue and List-Process). These modules are similar to the button modules in the main window.

  1. Select Command Window from the View menu to open the Command window. Resize the window so that both command modules become visible (see Figure 93). Move the window so that you can still see the SDL Editor window and use the main window.

Figure 93 : The Command window

Note:

Whether the Command window shows any commands or not is preference dependent. If the window does not show these command modules at start-up, you may add the commands using the Add Command menu choice from the Command menu and specify each of the commands to add. See Figure 94.

Figure 94 : Specifying a command to add

The command modules show the following information:
  • The List-Ready-Queue command displays the process ready queue, i.e., an ordered list of all processes that are ready to execute a transition. The list contains an entry number (the position in the queue), the process instance, its current state, the number of signals in its input port, and the name of the signal that will cause the next transition. At this stage, both processes (Main and Demon) are to execute their start transition, so no signals are listed.
  • The List-Process command displays a list of all active processes in the system. It shows the same information as the List-Ready-Queue command above (with the exception of the additional "env" process, which represents the environment). At this stage, the two lists are identical.
  1. Execute the next transition and note the changes in the Command window. The Main process is removed from the ready queue since it needs a signal input (Newgame) to execute the next transition, but this signal has not yet been sent. The process list shows the new state of Main (Game_Off).
  2. Execute the next transition. The ready queue is now empty since the Demon process needs an input of the timer signal T, but this timer has not yet expired.
  3. Send the signal Newgame from the environment. The Command window shows that Newgame has entered the signal input port of Main, thus adding Main to the ready queue.
  4. You may also print a list of all signals in the input port of the process in turn to execute. The command for this is not available through a command button. Instead, locate the menu Examine in the menu bar and select the Input Port command. For each signal an entry number (the position in the signal queue), the signal name, and the sender of the signal is printed. The asterisk before the entry number of Newgame indicates that this signal will be consumed by the process in the next transition.

Viewing Variables and Process Instances

Apart from the Command window, you can also continuously monitor variable values by using the Watch window. We will now monitor the variable GameP in process Main to see how its value changes as the process Game is started and later stopped.

  1. Open the Watch window by selecting Watch Window from the View menu. If needed, move it so that you can also see the contents of the Command window.
  2. In the Watch window, select Add from the Watch menu to add a variable to the list of variables to display.
  3. In the dialog, you have to specify both the process (within parenthesis) and the variable name. Enter (Main) GameP and click OK.

Figure 95 : Adding a variable to watch

  1. The value null should now be displayed in the Watch window:

Figure 96 : Adding GameP to the Watch window

If necessary, resize the window so that the value becomes visible.
  1. Execute the next transition and check that the value of GameP in the Watch window changes to the value Game:1 as the process Game is created. Game is also added to the lists printed in the Command window.
  2. You can examine the newly created Game process. The information is printed by giving the command Examine-PId (enter ex-pid on the input line) and contains the current values of Parent, Offspring, and Sender. Parent is Main:1, as expected.
  3. Send the signal Endgame from the environment. Notice that Main is added to the ready queue, but after Game.
  4. Execute the next transition, which is the start transition of Game.
  5. You can now examine the Main process, since it is the next to execute. Give the command Examine-PId again and compare the values printed with those from the Game process.
  6. Execute the two next transitions to stop the Game process. Notice that the value of GameP is reset to null and that Game no more is listed in the Command window.

Other Viewing Options

There are a number of other viewing commands available in the Examine menu. You can list the active timers in the system, check the parameters of signal and timer instances, etc. We will conclude this exercise by showing that the system is not idle, even though the ready queue is now empty.

  1. Check that the timer T is still active by choosing Timer List in the Examine menu. The timer's name, corresponding process instance, and expiration time is printed.
  2. Execute the next transition. Try to examine the timer instance by giving the command Examine-Timer-Instance (enter ex-tim-ins on the input line). You are informed that the timer queue is empty, i.e. the timer T is no longer active.

http://www.ibm.com/rational
Contents Index Previous Next