nsserv.<os> ./bin/extraStats1 ./bin/extraStats2
The collection service displays status messages to standard output indicating when a client connects (i.e. when NetSpy starts up communication with this collection service) and one clients disconnect.
This is the main NetSpy window, and it is from here that NetSpy functions are performed.
This menu selection will bring up the "Add New Host" dialog box. This dialog
box has the following appearance:
Figure A-2: "Add New Host" dialog box
The user is required to enter the name of the computer to be monitored into
the text field. Upon selection of the "OK" button an attempt is made to
contact the collection service running at the computer. An error will be
returned given any of the following conditions:
The various elements of this dialog box are described here:
- Shape Type
- This list contains all of the shape gadgets available to the user. One shape only must be selected from this list. This designates which shape will be drawn.
- Shape Name
- Every shape must be given a unique name by which it is identified in the other dialogs of the system. This name is entered in this text box. The name should not contain white space of commas. An error will occur if a duplicate name is used.
- Distributor Type
- This radio button group allows the user to choose the type of distributor to use when dealing with multiple instances of a statistic.
Note: at this time the hierarchy distributor has not been implemented.- Arranger
- This list displays the different arrangers available for laying copies of the shape gadget. This is necessary when there are multiple instances of a statistic and NetSpy must create multiple copies of a shape gadget to display the various instances. One arranger only must be selected from the list.
- Attach to:
- This list contains the names of all of the arranger objects within the scene to which this new shape object can be assigned. It will then be the responsibility of that gadget to place it within the scene. The [root] arranger is the default arranger for the whole scene. It is always present.
This dialog allows the user to place another arranger gadget into the scene for grouping shape gadgets together. These arrangers gadgets will appear in the "Attach to:" list of the "New Shape Dialog". The various fields of this dialog are:
- Arranger Type
- This list shows all of the different arrangers available to the user. One arranger only must be selected from this list.
- Arranger Name
- This text field is where the identifying name for this gadget is entered. The name must be unique amongst all of the gadgets within this scene. The name may not contain white space or commas.
- Attach to:
- The list contains the list of all of the arranger objects to which this new arranger can be attached. That existing arranger object will then be responsible for laying out the subscene created by this new arranger.
The fields in this dialog box are:
- Host
- This list shows the names of all of the computers from which statistics are being collected. One host only must be selected from this list.
- Metric
- This list shows all of the statistics being collected from the host currently selected in the "Host" list. Changing the selected host will cause this list to update its contents.
- Shape
- This list shows all of the shape gadgets in the scene that export degrees of freedom. One shape only must be selected from this list.
- Degree
- This list contains the list of all the degrees of freedom exported by the currently selected shape gadget in the "Shape" list. If the selection in the "Shape" list is changed, this list will automatically update. One degree only must be selected from this list
When the user selects the "OK" button a connection is established between the chosen statistic and the degree of freedom.
The viewer controls are shown in the following figure:
Figure A-7: Viewer controls
Once a scene has been saved once, any additions made can be saved to the same file (overwriting the old one) using the "Save" option from the "File" menu.
To load a scene file previously saved use the "Open..." option from the "File" menu. This will bring up the file selection dialog box (similar to the one for saving files) to allow the user to select the file to load. By default, only those files ending in ".ns" are displayed. This can be changed manually though.
The protocol defines two distinct sections that must be included: a preamble and the body. The preamble consists of the details of the statistics being collected here. The body, which is of indefinite duration once it begins is the values of these statistics, updated at some regular interval.
<metric name> <ID> <Type> <Semantics> <Units> [<Instance>...]where:
<instance name> <ID>where:
Each statistic definition line in the preamble must be followed by a newline
character (ASCII 10). After all of the statistics have been defined the line:
!!end!!followed by a newline character should be output.
The format of the line is as follows:
<metric ID> <Values> [<metric ID> <Values> ...where <Values> is of the form:
0 <value>for single instance statistics, and:
<instance ID> <value> [<instance ID> <value> ...The various elements are defined as:
Firstly there is some common code that must be included for every kind of gadget. This code is related to the run-time identification of gadget types. At certain points it is necessary for NetSpy to check that gadgets are of the necessary type, for example when the user connects a statistic to a gadget that gadget must be a distributor. The following methods must be implemented following the pattern described:
virtual int NewShapeType::isOfType( const string& type )
{
if( type == NewShapeType::className() )
return 1;
return GadgetBase::isOfType( type );
}
virtual GadgetBase* NewShapeGadget::copy( const string& name )
{
NewShapeGadget* nsg = new NewShapeGadget(name);
copyData(nsg);
return nsg;
}
static void <degree>Callback( GadgetBase* gb, Value& value )
{ ((NewGadgetShape*)gb)-><degree>Change( value ); }
To register the callback functions the the addCallback() member of
GadgetBase should be called in the constructor. If our new class is
called NewShapeGadget and it exports a degree called "size" the call
to this member would be as follows:
virtual GadgetBase* NewArranger::copy()
{
return copy( "NewArranger" );
}