How do I set up and use a dimensioned statistic?
How do I set up and use a dimensioned statistic?
A dimensioned statistic is set up using the op_stat_reg KP. The number of dimensions for a statistic is determined by the number of times the op_stat_reg KP is called with a unique value of stat_index - which is the second parameter to this KP. For example, the following code fragment registers a statistic that can have thirty two dimensions:/* Define an array of stathandles as a state variable. */Stathandle my_stathdl_array [32];/* Register each dimension of the statistic and initialize *//* the SV. */for (i = 0; i < 32; ++i) { my_stathdl_array [i] = op_stat_reg ( My Dimensioned Statistic, i, OPC_STAT_GLOBAL); }When a new data value needs to be written to a particular dimension of the statistic the appropriate statistic handle should be used. For example the following code fragment writes a new data value to the third dimension of the above statistic:op_stat_write (my_stathdl_array [2], stat_value);Declaration of dimensioned statistics:The statistic should be declared in the local/global statistic table and the mode should be set to dimensioned.
DES Kernel->Statistics and Reports