Statistic Wires

Statistic wires are connections between modules within a node that convey individual values rather than packets. The following figure shows typical uses of statistic wires.

Figure 167: Typical Uses of Statistic Wires

Typical uses of statistic wires

Statistic wires carry data from a source module to a destination module. Unlike packet streams, which convey packets, statistic wires convey individual values. They are generally used as an interface by which the source module can share certain values with the destination module, and thereby provide information regarding its state. They are also used as a signalling mechanism, allowing the source module to notify the destination module that a particular condition of interest has been reached.

Each module within a node has a set of local output statistics whose values are updated at correct times during the simulation. It is this set of statistics that can act as the sources of statistic wires. Processor and queue modules, which can execute user-defined process models, have a set of statistics whose computation and interpretation are defined by their process model. These statistics are updated when the process model calls the Kernel Procedure op_stat_write() (refer to “Process Domain” on page 165 for more information on user-defined local output statistics). Other modules have a predetermined set of statistics that are updated automatically by the Simulation Kernel at appropriate times. Each statistic wire can convey only one output statistic, which is specified in the src stat attribute of the statistic wire, as shown in the following figure.

Figure 168: Statistic Wire Source Statistic Selection

Statistic wire source statistic selection

Processor and queue modules also have a set of input statistics, which act as destinations for statistic wires. Process models within these modules can access the current value of a particular input statistic by calling the Kernel Procedure op_stat_local_read(). The statistic wire binds together an output statistic and an input statistic, so that their values change in a linked manner. In this way the value sharing described above is accomplished. Note that an output statistic can be the source of many statistic wires, and similarly an input statistic can be the destination of more than one statistic wire.

When the value of a statistic changes, the destination module can be notified by means of a “statistic interrupt”. The conditions under which this interrupt occurs can be controlled by means of attributes of the statistic wire, called statistic triggers. For instance, a wire can be set to cause an interrupt when its statistic becomes larger than a particular value, or when it becomes smaller than its previous value. If no triggers are enabled, then no “statistic interrupts” will occur, and the destination module must poll the input statistic on its own to determine if its value has changed.

Statistic wires are typically used in one of two ways within node models. First, they may be employed to dynamically monitor the state of another component of a communication node. Often this is an “unintelligent” physical device like a transmitter or receiver, but it might also be a queue module, for example, if a processor needed to alter its behavior based on the size of a queue. In these cases, the statistics being monitored are computed automatically by the Simulation Kernel. Second, statistic wires may be used to allow one module to signal another of a change in its state. Such uses are often called semaphores. In contrast to the first case, these values are computed by a process within a processor or queue module.

An example of both uses can be seen in the ethcoax_station_adv node model shown in the following figure. The defer module computes a variable called “deference” and supplies it to the mac module via a statistic wire, to inform it when it can transmit the next packet. The defer module computes this value from two input statistics: one is a value supplied to defer by mac, indicating whether it has packets awaiting transmission, and the other is the value of the “busy” statistic from the bus receiver module. Here the “deference” and “packets waiting” statistic wires are used as semaphores, whereas the “busy” wire is used as a monitor.

Figure 169: ethcoax_station_adv Node Model

ethcoax_station_adv node model