Documentation
IPS_GetInstanceMessageStatistics
array IPS_GetInstanceMessageStatistics ()
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 receiving instance |
| Count | integer | Number of processed messages |
| Duration | integer | Total processing duration in milliseconds |
| MaxDuration | integer | Longest processing of a message 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 message processing per instance. It records how many messages an instance has processed in its MessageSink and how long this took. The values are summed up since the start of IP-Symcon, durations are rounded down to whole milliseconds. The current number of not yet processed messages is returned by IPS_GetInstanceMessageQueueSize.
The statistics are only recorded if the special switch "MessageQueueWatch" is enabled (e.g. with IPS_SetOption). Otherwise the function fails with "This function is only available if the special option 'MessageQueueWatch' is enabled!".
If "MessageQueueWatch" is enabled, a message is additionally written to the log if the processing of a message takes longer than "MessageQueueWatchLimit" milliseconds (0 = disabled).
Example
// Output the average processing duration of the messages per instance
foreach (IPS_GetInstanceMessageStatistics() as $entry) {
printf("#%d: %d messages, %.1f ms on average, max. %d ms\n", $entry['InstanceID'], $entry['Count'], $entry['Duration'] / $entry['Count'], $entry['MaxDuration']);
}
/* e.g. returns:
#23456: 1520 messages, 0.4 ms on average, max. 37 ms
*/