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