Merged in hotfix/MAPG-184-show-runtime (pull request #158)
MAPG-184 measure runtime and show in web output
This commit is contained in:
commit
5e645a1313
2
main.php
2
main.php
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
define('SCRIPT_STARTED', hrtime(true));
|
||||||
|
|
||||||
require 'vendor/autoload.php';
|
require 'vendor/autoload.php';
|
||||||
|
|
||||||
const ROOT = __DIR__;
|
const ROOT = __DIR__;
|
||||||
|
@ -26,6 +26,8 @@ class HtmlContent extends ContentBase
|
|||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
|
$content .= '<!-- __debug__runtime: ' . round((hrtime(true) - SCRIPT_STARTED) / 1e+6, 1) . ' -->';
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,8 @@ class JsonContent extends ContentBase
|
|||||||
|
|
||||||
public function &render(): string
|
public function &render(): string
|
||||||
{
|
{
|
||||||
|
$this->data['__debug__runtime'] = round((hrtime(true) - SCRIPT_STARTED) / 1e+6, 1);
|
||||||
|
|
||||||
$content = json_encode($this->data);
|
$content = json_encode($this->data);
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
|
Loading…
Reference in New Issue
Block a user