MAPG-184 measure runtime and show in web output

This commit is contained in:
Bence Pőcze 2020-06-27 01:19:17 +02:00
parent b4769b62dd
commit 9c9edcbbd1
Signed by: bence
GPG Key ID: AA52B11A3269D1C1
3 changed files with 6 additions and 0 deletions

View File

@ -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__;

View File

@ -19,6 +19,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;
} }

View File

@ -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;