mirror of
https://github.com/friendica/friendica
synced 2025-04-28 17:44:22 +02:00
Improved performance profiler
This commit is contained in:
parent
9c0342b907
commit
5fb83d0632
5 changed files with 33 additions and 7 deletions
|
@ -30,6 +30,7 @@ use Friendica\Module\HTTPException\MethodNotAllowed;
|
|||
use Friendica\Module\HTTPException\PageNotFound;
|
||||
use Friendica\Network\HTTPException\MethodNotAllowedException;
|
||||
use Friendica\Network\HTTPException\NotFoundException;
|
||||
use Friendica\Util\Profiler;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
|
@ -234,7 +235,7 @@ class Module
|
|||
*
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public function run(Core\L10n $l10n, App\BaseURL $baseUrl, LoggerInterface $logger, array $server, array $post)
|
||||
public function run(Core\L10n $l10n, App\BaseURL $baseUrl, LoggerInterface $logger, Profiler $profiler, array $server, array $post)
|
||||
{
|
||||
if ($this->printNotAllowedAddon) {
|
||||
notice($l10n->t("You must be logged in to use addons. "));
|
||||
|
@ -266,10 +267,15 @@ class Module
|
|||
|
||||
$placeholder = '';
|
||||
|
||||
$profiler->set(microtime(true), 'ready');
|
||||
$timestamp = microtime(true);
|
||||
|
||||
Core\Hook::callAll($this->module . '_mod_init', $placeholder);
|
||||
|
||||
call_user_func([$this->module_class, 'init'], $this->module_parameters);
|
||||
|
||||
$profiler->set(microtime(true) - $timestamp, 'init');
|
||||
|
||||
if ($server['REQUEST_METHOD'] === 'POST') {
|
||||
Core\Hook::callAll($this->module . '_mod_post', $post);
|
||||
call_user_func([$this->module_class, 'post'], $this->module_parameters);
|
||||
|
|
|
@ -36,6 +36,7 @@ use Friendica\Module\Special\HTTPException as ModuleHTTPException;
|
|||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\Profiler;
|
||||
|
||||
/**
|
||||
* Contains the page specific environment variables for the current Page
|
||||
|
@ -375,7 +376,7 @@ class Page implements ArrayAccess
|
|||
*
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public function run(App $app, BaseURL $baseURL, Mode $mode, Module $module, L10n $l10n, IConfig $config, IPConfig $pconfig)
|
||||
public function run(App $app, BaseURL $baseURL, Mode $mode, Module $module, L10n $l10n, Profiler $profiler, IConfig $config, IPConfig $pconfig)
|
||||
{
|
||||
$moduleName = $module->getName();
|
||||
|
||||
|
@ -384,7 +385,9 @@ class Page implements ArrayAccess
|
|||
*
|
||||
* Sets the $Page->page['content'] variable
|
||||
*/
|
||||
$timestamp = microtime(true);
|
||||
$this->initContent($module, $mode);
|
||||
$profiler->set(microtime(true) - $timestamp, 'content');
|
||||
|
||||
// Load current theme info after module has been initialized as theme could have been set in module
|
||||
$currentTheme = $app->getCurrentTheme();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue