added performance messurements

This commit is contained in:
kremsy 2017-05-10 11:09:59 +02:00
parent 7c74baf9d2
commit 05afe1c3bb

View File

@ -4,7 +4,6 @@ namespace ManiaControl\Callbacks;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\Logger;
use ManiaControl\ManiaControl;
/**
@ -231,9 +230,9 @@ class CallbackManager implements UsageInformationAble {
}
// Handle callbacks
$timings = array();
$startTime = microtime(true);
$callbacks = $this->maniaControl->getClient()->executeCallbacks();
$timings = array();
$startTime = microtime(true);
$callbacks = $this->maniaControl->getClient()->executeCallbacks();
$timings["executeCallbacks"] = microtime(true) - $startTime;
foreach ($callbacks as $callback) {
@ -242,8 +241,9 @@ class CallbackManager implements UsageInformationAble {
$timings[$callback[0]] = microtime(true) - $time1;
}
if($fulltime = ((microtime(true) - $startTime) > 1)){
$this->maniaControl->getErrorHandler()->triggerDebugNotice(json_encode(array("Long Loop Detected: " .$fulltime, $timings)));
$fullTime = microtime(true) - $startTime;
if ($fullTime > 1) {
$this->maniaControl->getErrorHandler()->triggerDebugNotice(json_encode(array("Long Loop Detected: " . $fullTime , $timings)));
}
}