« Back to Product

Documentation

UC_GetScriptSenderList

 array UC_GetScriptSenderList (int $InstanceID) 

Parameters

InstanceID

ID for the Util Control

Returns

An array with one entry per trigger that has executed a script since the start. Each entry contains the following key => value pairs:

Index Type Description
Count integer Number of script executions of this trigger
Sender string Trigger of the script execution as in $_IPS['SENDER'], e.g. "TimerEvent", "Variable" or "RunScript"

Description

The function counts every started script execution (message SE_RUNNING) and assigns it to the trigger. The trigger corresponds to the value of the system variable $_IPS['SENDER'] in the script, e.g. "TimerEvent" for cyclic events, "Variable" for triggered events, "WebFront" for operations in the visualization or "RunScript" for IPS_RunScript. This allows to identify where a high script load comes from, e.g. if UC_GetKernelStatistics shows a permanently filled RequestQueueSize. The currently running scripts are returned by IPS_GetScriptThreadList.

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 script executions per trigger
foreach (UC_GetScriptSenderList($id) as $entry) {
    echo $entry['Sender'] . ': ' . $entry['Count'] . PHP_EOL;
}
Any questions?