Simulation statistics

It is possible to print the simulation statistics to the Simulation plane of the Command View. This is a useful feature if you want to see how much processor time primitives or modules need in simulation and how many times each instance fires.

This function is activated by the PTcl command stats on. Simulation time is increased by between 15 and 30 percent depending on the complexity of the model when statistics collection is active. We recommend you keep the stats turned off when possible.

The following steps describe an example session:

  1. Switch to Simulation Mode and enter stats on into the Simulation plane of the Console View.
  2. Run the simulation and type stats into the Simulation plane of the Console View after the simulation has finished.
  3. The stats are written to the same console.

It is also possible to write the stats to a file.

  1. Type set fd [open "MySimulation.stats" w] into the Simulation plane of the Console View to create a file.
  2. To write the statistics to the file, type puts $fd [stats recursive].
  3. When you are done type close $fd to close the file and stats off to deactivate the gathering of statistical information.

The file now holds all the relevant information regarding the simulation and can be viewed using a text editor. As an example the statistics of the testPacket demo which can be found in MLD Libraries→DE→Demo.

Module testPacket:

Primitive Clock#1 1.609375 52
Primitive Ramp#1 1.609375 51
Primitive Packetize#1 1.609375 51
Primitive UnPacketize#1 1.609375 60
Primitive VarServer#1 1.609375 10
Primitive XMgraph.input=2#1 1.625 51
Primitive ExecuteInOrder.Out=2#1 1.625 20
Module UniformFloatConst#1 1.625
Primitive auto-fork-node0 1.625 51
Primitive auto-fork-node1 1.625 51
Primitive ITerminator#24 1.625 0

Sum module testPacket: 17.796875

Module UniformFloatConst#1:

Primitive RandomConst#1 1.625 10

Sum module UniformFloatConst#1: 1.625

The file contains four columns:

  1. The type of model instance.
  2. The Name and instance number of the model instance
  3. The processor time needed in seconds and tenths of a second.
  4. The total number of times the model instance fired.

In this case the total processor time is measured in 100ths of a second and the .stats file shows 10ths of a second.

The simulation must run for more than one tenth of a second processor time.