The Tornado browser conveniently monitors the state of your target. The main browser window summarizes active system and application tasks, memory consumption, and a summary of the current target memory map. Using the browser, you can also examine:
button. This launches a browser for the currently selected target server (see Tornado Launch Toolbar).
The top of the browser window, shown in Figure 9-2, allows you to request particular browser displays and to control other browser functionality.
|
See 9.6 Task-List Window. |
|||||||||||||||||||
|
See 9.10 The Spy Window. |
|||||||||||||||||||
|
See 9.12 The Vector Table Window. This selection is available only on supported architectures. |
|||||||||||||||||||
The button bar at the top right of each browser window provides the following controls:
Immediate-update button. Use this button to update all browser displays immediately. You can use this button for an immediate update even if a periodic update is running.
Periodic-update button. This button is a toggle: press it to request or cancel regular updates of all browser displays (the time period between updates is one of the parameters controlled by the
button, described below).
Parameter adjustment button. Press this button to adjust the parameters that govern the browser's behavior. Figure 9-3 shows the Browser Configuration dialog box, displayed when you click this button.
The Target Information window (Figure 9-4) displays the following summary information about the selected target:
Figure 9-5 shows two examples of the task list produced by clicking Tasks in the browser window selector.
Each task list is marked with a small
(minus sign) icon.You can double-click on this icon to hide data that is not of current interest; the browser changes the marker to a small
(plus sign) to indicate that hidden data is available. To reveal the contents of a hidden task list, click the
plus-sign icon. (This convention for controlling the display of hierarchical information is used in many parts of Tornado.)
The task-summary display (for either system or application tasks) includes the task ID, the task name (if known), and the task state.
You can display detailed information on any of these tasks by clicking on the summary line for that task; see 9.8.1 The Task Browser.
Figure 9-6 shows an example of the window produced by clicking Memory Usage in the browser window selector.
The Memory Usage window has the following areas:
The two bar graphs in this area show what proportions of target memory are currently in use.
The upper bar shows the state of the memory pool managed by the target agent.2 This represents target memory consumed by Tornado tools, for example with dynamically linked modules or for variables defined from the shell.
Clicking Object Information in the browser window selector brings up a window where you can request a specialized display for VxWorks system objects (Figure 9-7). Type or paste either the name or the ID of a system object in the text box next to the Show button. Then click Show (or press ENTER) to display information about that particular object. As a convenient shorthand, we refer to the browser's object-information windows as object browsers: task browsers, semaphore browsers, and so on.
Another way to bring up an object-information window is to click on the name of an object in the module browser (9.9 The Module-Information Window). If the object is a recognized system object, the data area for it is displayed just as if you had copied the name to the Show box.
For example, Figure 9-7 shows the Show box filled in with a request to display an object called graphSem.
To see more detailed information about a particular task, click on any task's summary line in a browser Tasks window (or enter the task name or task ID in the Show box of an Object Information browser window). The browser displays a window for that task, similar to Figure 9-8.
At the top of the task browser you can see global task attributes, and information about stack allocation and usage. The last major region shows the hardware registers for this task; their precise organization and contents depends on your target architecture. As usual, a scrollbar is displayed if more room is needed.
Notice the
(minus sign) icons; the lines they mark categorize the task information. As in other parts of Tornado that display hierarchical data, you can hide categories by clicking on any
icon, or expose hidden categories by clicking on any
(plus sign) icon.
Figure 9-9 shows another task browser running on the same target, but with most of the hardware registers hidden.
To inspect a semaphore, enter either its name or its semaphore ID in the Show box of a browser window with Object Information selected. A specialized semaphore browser appears, similar to the one shown in Figure 9-10. The semaphore browser displays both information about the semaphore itself (under the heading Attributes), and the complete queue of tasks blocked on that semaphore, under the heading Blocked Tasks.
Figure 9-10 shows a binary semaphore with several blocked tasks in its queue. As in other browser windows, you can click on the levels of the display to control detail. To start a browser for any queued task, click on the task name or ID; both are displayed for each task.
POSIX semaphores have a somewhat different collection of attributes, and the browser display for a POSIX semaphore reflects those differences. Similarly, the semaphore browser adapts to shared-memory semaphores.
To inspect a message queue, enter its name or message-queue ID in the Show box of a browser window with Object Information selected. A message-queue browser like the one in Figure 9-11 is displayed.
In addition to displaying the attributes of the message queue, the message-queue browser shows three queues:
The memory-partition browser comes up when you enter a memory partition ID (or the name of a variable containing one) in the Show box of a browser window with Object Information selected, as do all specialized browser windows. Figure 9-12 shows the VxWorks system memory partition, memSysPartId.
When the Tornado browser recognizes a watchdog-timer ID (or a variable containing one) in the Show box of a browser window with Object Information selected, it displays a window like those shown in Figure 9-13.
Before you start a timer, the display resembles the one on the left of Figure 9-13; only the state field is particularly meaningful. However, after the timer starts counting, you can see the number of ticks remaining, the address of the routine to be executed when the timer expires, and the address of the routine's parameter.
VxWorks kernel objects are implemented as related classes: collections of objects with similar properties. Each class has an identifier in the run-time; the symbol names for these identifiers end with the string ClassId, making them easy to recognize. When you enter a class identifier in the Show box of a browser window with Object Information selected, the browser displays overall information about the objects in that class.
For example, Figure 9-14 shows the display for semClassId (the semaphore class).
To inspect the memory map of any currently loaded module, click on the line that lists that module in the loaded-module list (described in 9.7 Memory-Usage Window).
The browser opens a module-information window resembling Figure 9-16 for the selected object module.
Each symbol's display occupies one line. The symbol display includes the symbol's address in hexadecimal, a letter representing the symbol type (Table 9-1), and the symbol name (in its internal representation--C++ symbols are displayed "mangled," and all compiled-language symbols begin with an underbar).
|
|
|||||||||||||||||||
|
|
|||||||||||||||||||
|
|
|||||||||||||||||||
|
|
|||||||||||||||||||
Symbol displays are grouped by category. There is one category for the symbols in each section, plus a category headed Other_Symbols that contains uninitialized globals and unrecognized symbols.
For symbols that represent system objects, clicking on the symbol name brings up the corresponding object browser; see 9.8 Object-Information Windows.
Clicking Spy Chart in the browser window selector produces a display similar to Figure 9-17. This window reports on CPU utilization for each task on your target, as a percentage of CPU cycles. Besides tasks, the spy window always includes the following additional categories for CPU-cycle usage: time spent in the kernel, time spent in interrupt handlers, and idle time. These additional categories appear below all task data; you may need to use the scrollbar to see them.
Spy data is reported in one of two modes (selected with the Browser Configuration dialog box shown in Figure 9-3). When the Differential check box is off in the Browser Parameters dialog box (see 9.4 Browser Buttons), the spy window is in cumulative mode: it shows total CPU usage since you first display the spy window. Spy reports in differential mode reflect only the CPU usage since the last update.
The spy window uses the facilities of the VxWorks target software in spyLib (which is automatically downloaded to the target when you request a spy window, if it is not already present there). For related information, see the reference entries for spyLib.
Clicking Stack Check in the browser window selector produces a window similar to Figure 9-18. The stack-check window summarizes the current and maximum stack usage for each task currently running.
|
|
|||||||||||||||||||
To inspect the interrupt/exception vector table, click Vector Table in the browser window selector. (This facility is available for all target architectures except the Windows simulator, PowerPC, and ARM.) The display is similar to Figure 9-19.
Vectors are numbered from 0 to X (X = number of interrupt/exception vectors). The connected routines or addresses are displayed, or if no routine is connected the following key words are be displayed:
If your communications link to the target is slow (a serial line, for example), use the browser judiciously. The traffic back and forth to the target grows with the number of objects displayed, and with the update frequency. On slow links, this traffic may seriously slow down overall Tornado performance. If you experience this problem, try displaying fewer objects, updating browser displays on request instead of periodically, or setting updates to a longer interval.
The memory-consumption bar graphs in the Memory Usage window makes memory leaks easy to notice. If the allocated portion of memory grows continually, you have a problem. The memory-consumption graph in Figure 9-20 indicates a memory leak in an application that has run long enough to exhaust memory almost completely.
A more subtle memory-management problem occurs when small blocks of memory that are not freed for long periods are allocated interleaved with moderate-sized blocks of memory that are freed more frequently: memory can become fragmented, because the calls to free( ) for the large blocks cannot coalesce the free memory back into a single large available-memory pool. This problem is easily observed by examining the affected memory partition (in many applications this is the VxWorks system memory partition, memSysPartId) with the browser. Figure 9-21 shows an example of a growing free-list with many small blocks, characteristic of memory fragmentation.
When a task exceeds its stack size, the resulting problem is often hard to trace, because the initial symptom may be in some other task altogether. The browser's stack-check window is useful when faced with behavior that is hard to explain: if the problem is a stack overflow, you can spot it immediately (Figure 9-22).
Browser displays are most useful when they complement each other. For example, suppose you notice in a task-list window (as in Figure 9-23) that a task uHi, expected to be high priority, is blocked while two other tasks are ready to run.
An immediate thing to check is whether the three tasks really have the expected priority relationship (in this example, the names are chosen to suggest the intended priorities: uHi is supposed to have highest priority, uMed medium priority, and uLow the lowest). You can check this immediately by clicking on each task's summary line, thus bringing up the windows shown in Figure 9-24.
Unfortunately, that turns out to be the wrong explanation; the priorities (shown for each task under Attributes) are indeed as expected. Examining the CPU allocations with the spy window (Figure 9-25) reveals that the observed situation is ongoing; uMed is monopolizing the target CPU. It should certainly execute by preference to the low-priority uLow, but why is uHi not getting to run?
At this point examining the code (not shown) may seem worthwhile. Doing so, you notice that uMed uses no shared resources, but uHi and uLow synchronize their work with a semaphore. Could that be the problem?
Examining the semaphore with the browser (Figure 9-26) confirms this suspicion: uHi is blocking on the semaphore, which uLow cannot release because uMed has preempted it.
When the browser begins executing, it first checks for a file called .wind\browser.tcl in two places: first under c:\tornado, and then in the directory specified by the HOME environment variable (if that environment variable is defined). In each of these directories, if a browser.tcl file is found, its contents are sourced as Tcl code; this gives you an opportunity to customize the browser.
1: You can also restrict your target servers to permit connections only by a particular list of users; see Sharing and Reserving a Target Server.
2: To set the size of this memory pool, see Scaling the Target Agent.