Refactor dynamic App::getProfiler() to static DI::profiler()

This commit is contained in:
nupplaPhil
2019-12-15 23:50:35 +01:00
parent e2b2778e0a
commit 181529f3df
12 changed files with 22 additions and 30 deletions

View File

@@ -286,7 +286,7 @@ class Addon
$stamp1 = microtime(true);
$f = file_get_contents("addon/$addon/$addon.php");
$a->getProfiler()->saveTimestamp($stamp1, "file", System::callstack());
DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
$r = preg_match("|/\*.*\*/|msU", $f, $m);

View File

@@ -75,7 +75,7 @@ class Renderer
exit();
}
$a->getProfiler()->saveTimestamp($stamp1, "rendering", System::callstack());
DI::profiler()->saveTimestamp($stamp1, "rendering", System::callstack());
return $output;
}
@@ -102,7 +102,7 @@ class Renderer
exit();
}
$a->getProfiler()->saveTimestamp($stamp1, "file", System::callstack());
DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
return $template;
}

View File

@@ -73,10 +73,9 @@ class Theme
return $info;
}
$a = \get_app();
$stamp1 = microtime(true);
$theme_file = file_get_contents("view/theme/$theme/theme.php");
$a->getProfiler()->saveTimestamp($stamp1, "file", System::callstack());
DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
$result = preg_match("|/\*.*\*/|msU", $theme_file, $matches);

View File

@@ -386,7 +386,7 @@ class Worker
// We use the callstack here to analyze the performance of executed worker entries.
// For this reason the variables have to be initialized.
$a->getProfiler()->reset();
DI::profiler()->reset();
$a->queue = $queue;
@@ -443,7 +443,7 @@ class Worker
Logger::info('Process done.', ['priority' => $queue["priority"], 'id' => $queue["id"], 'duration' => round($duration, 3)]);
$a->getProfiler()->saveLog(DI::logger(), "ID " . $queue["id"] . ": " . $funcname);
DI::profiler()->saveLog(DI::logger(), "ID " . $queue["id"] . ": " . $funcname);
$cooldown = Config::get("system", "worker_cooldown", 0);