« Back to Product

Documentation

UC_GetMessageSenderIDList

 array UC_GetMessageSenderIDList (int $InstanceID) 

Parameters

InstanceID

ID for the Util Control

Returns

An array with one entry per sender that has sent a message since the start. Each entry contains the following key => value pairs:

Index Type Description
Count integer Number of messages of this sender
SenderID integer ID of the object that caused the message (0 = kernel or no object)

Description

The function counts all messages distributed by the kernel, separated by the sender. The sender is the object the message refers to, e.g. the variable for a variable update or the instance for a status change. This allows to find objects that create an unusually large number of messages, e.g. a variable that is updated several times per second. The amount of data per sender is returned by UC_GetMessageSenderIDSizeList, the distribution among the message types by UC_GetMessageTypeList.

The values are summed up in memory since the start of IP-Symcon and cannot be reset (only a restart starts again at 0). The order of the entries is not defined.

The ID of the Util Control instance can be determined e.g. with IPS_GetInstanceListByModuleID and the module GUID {B69010EA-96D5-46DF-B885-24821B8C8DBD}. If InstanceID does not exist, the function fails with "Instance #... does not exist", if the instance belongs to another module, with "Instance does not implement this function".

Example

// Determine the ID of the Util Control instance
$id = IPS_GetInstanceListByModuleID('{B69010EA-96D5-46DF-B885-24821B8C8DBD}')[0];

// Output the three most active senders
$list = UC_GetMessageSenderIDList($id);
usort($list, function ($a, $b) {
    return $b['Count'] <=> $a['Count'];
});
foreach (array_slice($list, 0, 3) as $entry) {
    echo $entry['SenderID'] . ': ' . $entry['Count'] . PHP_EOL;
}

/* e.g. returns:
0: 26
10008: 25
10012: 11
*/
Any questions?