added performance reports for long loops
This commit is contained in:
parent
7b3d5e4659
commit
7c74baf9d2
@ -4,6 +4,7 @@ namespace ManiaControl\Callbacks;
|
||||
|
||||
use ManiaControl\General\UsageInformationAble;
|
||||
use ManiaControl\General\UsageInformationTrait;
|
||||
use ManiaControl\Logger;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
@ -230,9 +231,19 @@ class CallbackManager implements UsageInformationAble {
|
||||
}
|
||||
|
||||
// Handle callbacks
|
||||
$timings = array();
|
||||
$startTime = microtime(true);
|
||||
$callbacks = $this->maniaControl->getClient()->executeCallbacks();
|
||||
$timings["executeCallbacks"] = microtime(true) - $startTime;
|
||||
|
||||
foreach ($callbacks as $callback) {
|
||||
$time1 = microtime(true);
|
||||
$this->handleCallback($callback);
|
||||
$timings[$callback[0]] = microtime(true) - $time1;
|
||||
}
|
||||
|
||||
if($fulltime = ((microtime(true) - $startTime) > 1)){
|
||||
$this->maniaControl->getErrorHandler()->triggerDebugNotice(json_encode(array("Long Loop Detected: " .$fulltime, $timings)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ class LibXmlRpcCallbacks implements CallbackListener {
|
||||
*/
|
||||
public function handleScriptCallback($name, $data) {
|
||||
if (!$this->maniaControl->getCallbackManager()->callbackListeningExists($name)) {
|
||||
//return; //Leave that disabled while testing/implementing Callbacks
|
||||
return; //Leave that disabled while testing/implementing Callbacks
|
||||
}
|
||||
switch ($name) {
|
||||
//New callbacks
|
||||
|
@ -73,7 +73,7 @@ class ShootManiaCallbacks implements CallbackListener {
|
||||
*/
|
||||
public function handleScriptCallbacks($name, $data) {
|
||||
if (!$this->maniaControl->getCallbackManager()->callbackListeningExists($name)) {
|
||||
//return; //Leave that disabled while testing/implementing Callbacks
|
||||
return; //Leave that disabled while testing/implementing Callbacks
|
||||
}
|
||||
switch ($name) {
|
||||
//MP4 New Callbacks
|
||||
|
@ -51,7 +51,7 @@ class TrackManiaCallbacks implements CallbackListener {
|
||||
*/
|
||||
public function handleScriptCallbacks($name, $data) {
|
||||
if (!$this->maniaControl->getCallbackManager()->callbackListeningExists($name)) {
|
||||
//return; //Leave that disabled while testing/implementing Callbacks
|
||||
return; //Leave that disabled while testing/implementing Callbacks
|
||||
}
|
||||
switch ($name) {
|
||||
case Callbacks::TM_SCORES:
|
||||
|
@ -323,7 +323,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
||||
$playerQuad->addTooltipLabelFeature($descriptionLabel, $description);
|
||||
}
|
||||
|
||||
if ($this->maniaControl->getServer()->isTeamMode()) {
|
||||
if ($this->maniaControl->getServer()->getScriptManager()->modeIsTeamMode()) {
|
||||
if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) {
|
||||
// Force to Red-Team Quad
|
||||
$redQuad = new Quad_Emblems();
|
||||
|
Loading…
Reference in New Issue
Block a user