Documentation
IPS_GetInstanceDataFlowStatistics
array IPS_GetInstanceDataFlowStatistics ()
Returns
An array with one entry per instance. The order of the entries is not guaranteed. Each entry contains the following key => value pairs:
| Index | Type | Description |
|---|---|---|
| InstanceID | integer | ID of the sending instance |
| TxCount | integer | Number of data sent to the parent instance |
| TxDuration | integer | Total processing duration in the parent instance in milliseconds |
| TxMaxDuration | integer | Longest processing in the parent instance in milliseconds |
| RxCount | integer | Number of deliveries to child instances |
| RxDuration | integer | Total processing duration in the child instances in milliseconds |
| RxMaxDuration | integer | Longest processing in a child instance in milliseconds |
Description
This function is intended for internal use only and may change or be removed at any time without notice.
The function returns the statistics of the data flow per instance. Tx records the data an instance sends to its parent instance and the duration until it has processed the data. Rx records the data an instance sends to its child instances and the duration until they have processed the data. Each delivery to a child instance is counted separately. The values are summed up since the start of IP-Symcon, durations are rounded down to whole milliseconds.
The statistics are only recorded if the special switch "DataFlowWatch" is enabled (e.g. with IPS_SetOption). Otherwise the function fails with "This function is only available if the special option 'DataFlowWatch' is enabled!".
If "DataFlowWatch" is enabled, a message is additionally written to the log if a processing takes longer than "FlowWatchTxLimit" or "FlowWatchRxLimit" milliseconds (0 = disabled).
Example
// Output the instances with the longest processing in the data flow
$statistics = IPS_GetInstanceDataFlowStatistics();
usort($statistics, function ($a, $b) {
return ($b['TxDuration'] + $b['RxDuration']) <=> ($a['TxDuration'] + $a['RxDuration']);
});
foreach (array_slice($statistics, 0, 3) as $entry) {
printf("#%d: Tx %d (%d ms), Rx %d (%d ms)\n", $entry['InstanceID'], $entry['TxCount'], $entry['TxDuration'], $entry['RxCount'], $entry['RxDuration']);
}
/* e.g. returns:
#23456: Tx 120 (845 ms), Rx 5310 (2210 ms)
#34567: Tx 0 (0 ms), Rx 2655 (512 ms)
*/