This chapter describes the X Resources that are used to customize your WindView environment and the Tcl configuration commands. The sections in this chapter are:
This section contains the following topics:
The WindView site-wide application resource file, WindView, is located in the directory /usr/WindView/resource/app-defaults. This file contains the WindView default X Window System configuration information, and must be present for WindView to run.
The WindView-color (for color monitors) and WindView-grayscale (for grayscale monitors) application resource files are also located in this directory. Follow the instructions in the WindView release notes to use one of these files instead of the default file, WindView.
You can customize your WindView environment by editing your personal .Xdefaults file. However, if defaults have been loaded to the X server by the xrdb command, changes to your ~/.Xdefaults will not take effect until you have merged them with the server defaults. To see if defaults have been loaded to the server, enter:
xrdb –query |
If nothing is returned, there are no defaults in the X server and changes to ~/.Xdefaults will be visible the next time WindView is started. If text is returned, enter the following to merge your changes to the X server's set of defaults:
xrdb -merge ~/.Xdefaults |
Then restart WindView.
The following examples show some of the customizations to WindView you can make in your ~/.Xdefaults file:
To change the color of the executing state's stipple to yellow, add the following line:
WindView*ViewGraph.executingColor: yellow |
The other state colors can be changed by referring to the appropriate resources, such as supendedColor and readyColor.
To change the color of user-defined event #7 to red, add the following line:
WindView.user7Color: red |
![]() | Note: User-defined icon resources do not follow the same naming convention as other event icon resources. That is, do not use WindView*ViewGraph.user7Color: gray. |
To change the default size of a View Graph to 800 x 800 pixels, add the following line:
WindView*View.width: 800 WindView*View.height: 800 |
To change the directory that appears by default in the Selection field of the Analyze Event Log window to /my/logfile/dir, add the following line:
WindView*analyzeSelectionBox.directory: /my/logfile/dir |
To make the similar changes to the Open Event File and Save Event File windows, use the openSelectionBox and saveSelectionBox resources.
To change the background color of the context labels on the vertical axis of the View Graph to green, add the following line:
WindView*View*ctxLabels*XmPushButton.background: green |
To make a similar change to the color of the text in the context labels, use the WindView*View*ctxLabels*XmPushButton.foreground resource.
To use a smaller font in the context labels and reduce the distance between them, use the following two defaults:
WindView*ctxLabels*fontList: \ -adobe-courier-bold-r-normal--10-*-*-*-*-*-iso8859-1 WindView*ctxLabels.spacing: 0 |
To create the icon, use the X11 bitmap editor. The following shows the syntax of the bitmap command:[2]
bitmap [ -options ...] filename widthxheight |
For use with WindView, filename must be of the form userNumber, for example, user10.
For example, the following command line invokes the bitmap editor to create the user99 file, with a width of 20 pixels and a height of 20 pixels:
bitmap user99 20x20 |
A file like the following is created:
#define filename_width 20
#define filename_height 20
static char filename_bits[] = {
0x91, 0x04, 0xca, 0x06, 0x84,
0x04, 0x8a, 0x04, 0x91, 0x04
};
|
For examples of user event files, see the files in the directory wv/src/demo/dine/bitmaps/WindView/events/userDefined.
Now you can connect your icons to user events. First, in your .cshrc, set the WV_USER_ICONS environment variable to the location of your new icons.[3] For example:
setenv WV_USER_ICONS ~wv/resource/bitmaps/WindView/userDefined |
Run the source command on your .cshrc.
Now, whenever you call the rtmon_log_user_tstamp() function, the user event icon with the corresponding event number is displayed. For example, if you call rtmon_log_user_tstamp(99, NULL, 0), the icon described by the file user99 (if present) is displayed.
In the WindView default configuration, if you are using the Motif Window Manager, View Graph auxiliary windows (such as the View Control window and the Legend window) are iconified when the View Graph is iconified. These auxiliary windows cannot be iconified separately, and they cannot be stacked underneath the View Graph to which they belong.
You can override this behavior by adding the following line to your ~/.Xdefaults file:
WindView.independentDialogs: 1 |
This allows View Graph auxiliary windows to be iconified separately from the View Graph, and to be stacked in any order.
For every windview command-line argument, there is an equivalent X resource you can set in your ~/.Xdefaults file. These resources are known as application-specific resources, and are summarized in Table 6-1.
Table 6-1. WindView Application-Specific Resources
Argument | X Resource Name | Example Value |
|---|---|---|
-emc | eventMemCacheSize | WindView.eventMemCacheSize: 4 |
-id | independentDialogs | WindView.independentDialogs: 1 |
-it | initialTimeInterval | WindView.initialTimeInterval: 2 |
-nx | localTclInit | WindView.localTclInit: 0 |
-port | defaultTargetPort | WindView.defaultTargetPort: 6200 |
-target | targetHostName | WindView.targetHostName: mytarget |
-usrbuf | maxUserEventBufSize | WindView.maxUserEventBufSize: 1024 |
-x | extraTclInit | WindView.extraTclInit: \ /home/myMacros.tcl |
-xi | immediateTclExpr | WindView.immediateTclExpr: \ viewCreate |
The following list contains the hierarchical order of the widgets in the WindView GUI. For each widget, the instance name is given followed by the class name in square brackets. (If the widget is a popup, this is indicated by “>” immediately preceding its name). For more information, see the Open Software Foundation's OSF/Motif Programmer's Reference, Revision 1.2.
windview [ApplicationShell]
mainWindow [XmMainWindow]
Separator1 [XmSeparatorGadget]
Separator2 [XmSeparatorGadget]
Separator3 [XmSeparatorGadget]
mainMenuBar [XmRowColumn]
fileMenuButton [XmCascadeButton]
windowsMenuButton [XmCascadeButton]
helpMenuButton [XmCascadeButton]
>menuShell [XmMenuShell]
fileMenuPulldown [XmRowColumn]
openButton [XmPushButton]
saveButton [XmPushButton]
analyzeButton [XmPushButton]
quitButton [XmPushButton]
>menuShell1 [XmMenuShell]
windowsPulldown [XmRowColumn]
newGraphButton [XmPushButton]
targetControlButton [XmPushButton]
tclEvaluationButton [XmPushButton]
Tcl: Event Inspector [XmPushButton]
>menuShell2 [XmMenuShell]
helpPulldown [XmRowColumn]
helpContentsButton [XmPushButton]
helpContextButton [XmPushButton]
separator7 [XmSeparator]
aboutButton [XmPushButton]
messagesSW [XmScrolledWindow]
HorScrollBar [XmScrollBar]
VertScrollBar [XmScrollBar]
messagesText [XmText]
>fileSaveDialog [XmDialogShell]
saveSelectionBox [XmFileSelectionBox]
Items [XmLabelGadget]
ItemsListSW [XmScrolledWindow]
VertScrollBar [XmScrollBar]
HorScrollBar [XmScrollBar]
ItemsList [XmList]
Selection [XmLabelGadget]
Text [XmTextField]
Separator [XmSeparatorGadget]
OK [XmPushButtonGadget]
Apply [XmPushButtonGadget]
Cancel [XmPushButtonGadget]
Help [XmPushButtonGadget]
FilterLabel [XmLabelGadget]
Dir [XmLabelGadget]
FilterText [XmTextField]
DirListSW [XmScrolledWindow]
VertScrollBar [XmScrollBar]
HorScrollBar [XmScrollBar]
DirList [XmList]
>fileOpenDialog [XmDialogShell]
openSelectionBox [XmFileSelectionBox]
Items [XmLabelGadget]
ItemsListSW [XmScrolledWindow]
VertScrollBar [XmScrollBar]
HorScrollBar [XmScrollBar]
ItemsList [XmList]
Selection [XmLabelGadget]
Text [XmTextField]
Separator [XmSeparatorGadget]
OK [XmPushButtonGadget]
Apply [XmPushButtonGadget]
Cancel [XmPushButtonGadget]
Help [XmPushButtonGadget]
FilterLabel [XmLabelGadget]
Dir [XmLabelGadget]
FilterText [XmTextField]
DirListSW [XmScrolledWindow]
VertScrollBar [XmScrollBar]
HorScrollBar [XmScrollBar]
DirList [XmList]
>tclEvalDialog [XmDialogShell]
tclEvalForm [XmForm]
tclEntry [TclEntry]
tclEntryText [XmText]
>aboutDialog [XmDialogShell]
aboutMessageBox [XmMessageBox]
Symbol [XmLabelGadget]
Message [XmLabelGadget]
Separator [XmSeparatorGadget]
OK [XmPushButtonGadget]
Cancel [XmPushButtonGadget]
Help [XmPushButtonGadget]
>fileAnalyzeDialog [XmDialogShell]
analyzeSelectionBox [XmFileSelectionBox]
Items [XmLabelGadget]
ItemsListSW [XmScrolledWindow]
VertScrollBar [XmScrollBar]
HorScrollBar [XmScrollBar]
ItemsList [XmList]
Selection [XmLabelGadget]
Text [XmTextField]
Separator [XmSeparatorGadget]
OK [XmPushButtonGadget]
Apply [XmPushButtonGadget]
Cancel [XmPushButtonGadget]
Help [XmPushButtonGadget]
FilterLabel [XmLabelGadget]
Dir [XmLabelGadget]
FilterText [XmTextField]
DirListSW [XmScrolledWindow]
VertScrollBar [XmScrollBar]
HorScrollBar [XmScrollBar]
DirList [XmList]
>targetDialog [XmDialogShell]
targetForm [XmForm]
targetHostnameLabel [XmLabel]
targetHostnameField [XmTextField]
disconnectButton [XmPushButton]
eventDataPortField [XmTextField]
eventDataPortLabel [XmLabel]
separator5 [XmSeparator]
label [XmLabel]
loggingModeLabel [XmLabel]
rowColumn [XmRowColumn]
startCollectionButton [XmPushButton]
stopCollectionButton [XmPushButton]
separator6 [XmSeparator]
rowColumn1 [XmRowColumn]
cseButton [XmToggleButton]
tsteButton [XmToggleButton]
oseButton [XmToggleButton]
>View 1 [TopLevelShell]
View 1 [View]
board [XmBulletinBoard]
toolBar [XmRowColumn]
timeUnitSelect [XmRowColumn]
OptionLabel [XmLabelGadget]
OptionButton [XmCascadeButtonGadget]
seqLabel [XmLabel]
viewBtn [XmPushButton]
sep1 [XmSeparator]
zoomIn [XmPushButton]
zoomOut [XmPushButton]
panLeft [XmPushButton]
panRight [XmPushButton]
sep2 [XmSeparator]
viewPush [XmPushButton]
viewPop [XmPushButton]
viewXchg [XmPushButton]
sep3 [XmSeparator]
viewSearch [XmPushButton]
viewSearchLCtx [XmPushButton]
viewSearchL [XmPushButton]
viewSearchR [XmPushButton]
viewSearchRCtx [XmPushButton]
sep4 [XmSeparator]
legendBtn [XmPushButton]
>popup_timeUnitSelect [XmMenuShell]
timeUnitSelect [XmRowColumn]
button_0 [XmPushButtonGadget]
button_1 [XmPushButtonGadget]
button_2 [XmPushButtonGadget]
button_3 [XmPushButtonGadget]
axis [Axis]
ctxLabelSwin [XmScrolledWindow]
ScrolledWindowClipWindow [XmDrawingArea]
ctxLabels [XmRowColumn]
VertScrollBar [XmScrollBar]
HorScrollBar [XmScrollBar]
viewGraph [ViewGraph]
hsbar [XmScrollBar]
infoField [XmTextField]
>legendDialog [XmDialogShell]
legendForm [XmForm]
legend [Legend]
legendSwin [XmScrolledWindow]
ScrolledWindowClipWindow [XmDrawingArea]
rowcol [XmRowColumn]
pairForm [XmForm]
defaultUser [XmLabel]
defaultUser [XmLabel]
pairForm [XmForm]
unknown [XmLabel]
unknown [XmLabel]
pairForm [XmForm]
exception [XmLabel]
exception [XmLabel]
pairForm [XmForm]
intExit [XmLabel]
intExit [XmLabel]
pairForm [XmForm]
intEnt [XmLabel]
intEnt [XmLabel]
pairForm [XmForm]
tick:timeslice [XmLabel]
tick:timeslice [XmLabel]
pairForm [XmForm]
tick:watchdog [XmLabel]
tick:watchdog [XmLabel]
pairForm [XmForm]
tick:undelay [XmLabel]
tick:undelay [XmLabel]
pairForm [XmForm]
tick:timeout [XmLabel]
tick:timeout [XmLabel]
pairForm [XmForm]
taskSpawn [XmLabel]
taskSpawn [XmLabel]
pairForm [XmForm]
taskDelete [XmLabel]
taskDelete [XmLabel]
pairForm [XmForm]
taskDelay [XmLabel]
taskDelay [XmLabel]
pairForm [XmForm]
taskPrioritySet [XmLabel]
taskPrioritySet [XmLabel]
pairForm [XmForm]
taskSuspend [XmLabel]
taskSuspend [XmLabel]
pairForm [XmForm]
taskResume [XmLabel]
taskResume [XmLabel]
pairForm [XmForm]
taskSafe [XmLabel]
taskSafe [XmLabel]
pairForm [XmForm]
taskUnsafe [XmLabel]
taskUnsafe [XmLabel]
pairForm [XmForm]
semBCreate [XmLabel]
semBCreate [XmLabel]
pairForm [XmForm]
semCCreate [XmLabel]
semCCreate [XmLabel]
pairForm [XmForm]
semDelete [XmLabel]
semDelete [XmLabel]
pairForm [XmForm]
semFlush [XmLabel]
semFlush [XmLabel]
pairForm [XmForm]
semGive [XmLabel]
semGive [XmLabel]
pairForm [XmForm]
semMCreate [XmLabel]
semMCreate [XmLabel]
pairForm [XmForm]
semMGiveForce [XmLabel]
semMGiveForce [XmLabel]
pairForm [XmForm]
semTake [XmLabel]
semTake [XmLabel]
pairForm [XmForm]
wdCreate [XmLabel]
wdCreate [XmLabel]
pairForm [XmForm]
wdDelete [XmLabel]
wdDelete [XmLabel]
pairForm [XmForm]
wdStart [XmLabel]
wdStart [XmLabel]
pairForm [XmForm]
wdCancel [XmLabel]
wdCancel [XmLabel]
pairForm [XmForm]
msgQCreate [XmLabel]
msgQCreate [XmLabel]
pairForm [XmForm]
msgQDelete [XmLabel]
msgQDelete [XmLabel]
pairForm [XmForm]
msgQReceive [XmLabel]
msgQReceive [XmLabel]
pairForm [XmForm]
msgQSend [XmLabel]
msgQSend [XmLabel]
pairForm [XmForm]
signal [XmLabel]
signal [XmLabel]
pairForm [XmForm]
sigsuspend [XmLabel]
sigsuspend [XmLabel]
pairForm [XmForm]
pause [XmLabel]
pause [XmLabel]
pairForm [XmForm]
kill [XmLabel]
kill [XmLabel]
pairForm [XmForm]
safePend [XmLabel]
safePend [XmLabel]
pairForm [XmForm]
sigwrapper [XmLabel]
sigwrapper [XmLabel]
pairForm [XmForm]
suspended [XmDrawingArea]
suspended [XmLabel]
pairForm [XmForm]
delayed [XmDrawingArea]
delayed [XmLabel]
pairForm [XmForm]
pended [XmDrawingArea]
pended [XmLabel]
pairForm [XmForm]
ready [XmDrawingArea]
ready [XmLabel]
pairForm [XmForm]
executing [XmDrawingArea]
executing [XmLabel]
pairForm [XmForm]
locked [XmDrawingArea]
locked
|
Tcl, the Tool command language, is integrated into WindView. You can use it to customize some aspects of WindView behavior.
The following excerpt is from John K. Ousterhout's article, “Tcl: An Embeddable Command Language”:
Tcl is an interpreter for a tool command language. It consists of a library package that is embedded in tools (such as editors, debuggers, etc.) as the basic command interpreter. Tcl provides (a) a parser for a simple textual command language, (b) a collection of built-in utility commands, and (c) a C interface that tools use to augment the built-in commands with tool-specific commands.
![]() | Note: If the WindView default Tcl environment meets your needs, you need not follow the customization instructions in this section. |
This section contains the following topics:
For more Tcl reference information, see “Tcl Reference Page” in the file tclman.ps and “Tcl: An Embeddable Command Language” in tclgd.ps. After installation, these files are contained in the directory /usr/WindView/docs.
The WindView site-wide Tcl initialization file, WindView.tcl, is located in the directory vw/resource/tcl. This file contains the WindView default Tcl configuration information, and must be present for WindView to run.
When the windview program is invoked (see “Starting WindView”), the WindView.tcl file is read automatically. Then the following initialization files are read, if they exist. These are the files that you can create to customize WindView's behavior:
| ~/.windview.tcl | Your personal WindView Tcl initialization file. | |
| ./.windview.tcl | The current directory's WindView Tcl initialization file. | |
| filename | Any additional Tcl initialization file specified with the -x flag to the windview program. |
![]() | Note: Tcl initialization files are read automatically only at WindView startup. |
For example, you might want to create a ~/.windview.tcl file to customize the way WindView displays its windows when you invoke it. The following are examples of customizations you can make in the personal, current directories, or additional Tcl initialization files (the commands are discussed in detail in “WindView Extensions to Tcl”):
To cause a View Graph to be displayed each time you run WindView, include the following line in a Tcl initialization file:
set view [viewCreate] |
This creates a View Graph window and assigns the ID of that window to the Tcl variable view.
Change the size and position of the newly created View Graph by including this line:
viewPosition $view 10 10 800 400 |
This command places the View Graph with ID view so that its upper left-hand corner is at coordinates (10, 10) and its size is 800 pixels wide by 400 pixels tall. (The view variable is returned by the viewCreate command used in step 1.)
Open a processed event log by including this line:
eventFileOpen filename.wv |
Or, open a raw event log by including this line:
eventFileAnalyze filename.wvr |
Control the time interval displayed with either of the commands used above by including this line:
viewIntervalSet $view 1.00 1.50 |
This command adjusts the View Graph created in step 1 so that it displays the event data from 1.00 seconds to 1.50 seconds of the sample. If you are using sequential event display, specify the time interval in whole numbers. For example, specify from event 0 to event 25, or from event 1000 to event 1500.
You can generate user events with the rtmon_log_user_tstamp() function. You can customize the Event Inspector window so that it displays these qualifiers in a format that is appropriate for your needs.
The rtmon_log_user_tstamp() function call permits up to five integer qualifiers to be logged when the event occurs.
The following is an example program that shows how the rtmon_log_user_tstamp() function might be used to pass qualifiers to the WindView Event Inspector.
#include <stdio.h>
#include <stdlib.h>
#include <sys/rtmon.h>
#include <sys/sysmp.h>
/* a sample program that alternates between processors 1, 2,
and 3 and logs a user timestamp every TIC */
main()
{
int proc;
int count;
proc = 1;
count = 0;
/* start off running on processor 1 */
sysmp(MP_MUSTRUN, proc);
while (1) {
/* pause for a CLK_TCK */
sginap(1);
/* log a user timestamp:
we will use the processor as the identifier of the
event we log, as the man page indicates, this will
appear in the event stream as X where X is 1,
2, and 3 in turn. For demonstration purposes, we'll
log two event qualifiers, 17 and 11 and indicate
that by setting numb_quals to be 2 */
rtmon_log_user_tstamp(proc, 2, 17, 11, 0, 0, 0);
/* move to a different processor every 100 events we
log */
count++;
if ((count % 100) == 0) {
proc++;
if (proc == 3) proc = 1;
sysmp(MP_MUSTRUN, proc);
}
}
}
|
To see the data that was posted with the event, you must write a Tcl procedure that unpacks and displays the buffer. This Tcl procedure can be placed in one of the additional Tcl initialization files described in “Customizing WindView Tcl Initialization Files”. The following is an example Tcl procedure for the event just described:
proc usrEvent1Format {event} {
usrUnpack $event {
{“qualifier1” int}
{“qualifier2” int}
}
}
proc usrEvent2Format {event} {
usrUnpack $event {
{“qualifier1” int}
{“qualifier2” int}
}
}
proc usrEvent3Format {event} {
usrUnpack $event {
{“qualifier1” int}
{“qualifier2” int}
}
}
|
To use the new procedure, you must either restart WindView so that it reads the appropriate Tcl initialization file, or give the source command to the Tcl Evaluation window (described in “Using the Tcl Evaluation Window”).
The Tcl Evaluation window (displayed with the “Tcl Evaluation” command in the Windows menu; see Figure 6-2) can be used to submit commands directly to the Tcl interpreter running in the WindView session. For example, you can use this window to read in Tcl files that you have created while WindView is running, or to debug Tcl scripts.
To use this window, type the Tcl command or commands in the window. Press <Return> to start a new text line, for example, if you are typing a multi-command string.
To send a command to the Tcl interpreter, hold the <Ctrl> key and press <Return>.
For example, to find out which version of Tcl is integrated into your WindView executable, type the following into the Tcl Evaluation window:
info tclversion <Ctrl-Return> |
The following information is printed in the window after your command line:
7.0 |
To read in a new file of Tcl commands, type the following:
source filename <Ctrl-Return> |
This allows you to reread a particular Tcl initialization file after WindView is running. For example, to reread your personal Tcl initialization file, type the following:
source /my_home/.windview.tcl <Ctrl-Return> |
For more information on the Tcl commands, see “WindView Extensions to Tcl”, “Tcl Man Page,” and “Tcl: An Embeddable Command Language.”
This section describes the WindView extensions to Tcl. You can use these in Tcl scripts to automate your work. For examples, see “Customizing WindView Tcl Initialization Files”.
In this section, the following conventions are used: