From 45155b496e622cf57af337499514748ab7cee209 Mon Sep 17 00:00:00 2001 From: hahn <axel.hahn@iml.unibe.ch> Date: Fri, 22 Jul 2022 13:37:21 +0200 Subject: [PATCH] add memory in debug --- public_html/deployment/classes/logger.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public_html/deployment/classes/logger.class.php b/public_html/deployment/classes/logger.class.php index 3f572ea0..7da8dacb 100644 --- a/public_html/deployment/classes/logger.class.php +++ b/public_html/deployment/classes/logger.class.php @@ -8,6 +8,7 @@ class logger { protected $aMessages=array(); protected $bShowDebug=true; + protected $_iMemStart = false; /** @@ -16,6 +17,7 @@ class logger { * @return boolean */ public function __construct($sInitMessage="Logger was initialized.") { + $this->_iMemStart=memory_get_usage(); $this->add($sInitMessage); return true; } @@ -31,7 +33,7 @@ class logger { /** * enable client debugging by a given array of allowed ip addresses - * @param type $aIpArray + * @param array $aIpArray * @return boolean */ public function enableDebugByIp($aIpArray){ @@ -75,6 +77,12 @@ class logger { return false; } $sOut=''; + $iMem=memory_get_usage(); + $this->add('<hr>'); + $this->add('Memory on start: ' . number_format($this->_iMemStart, 0, '.', ',') . " bytes"); + $this->add('Memory on end: ' . number_format($iMem, 0, '.', ',') . " bytes"); + $this->add('Memory peak: ' . number_format(memory_get_peak_usage(), 0, '.', ',') . " bytes"); + $sStarttime=$this->aMessages[0]["time"]; $iCounter=0; -- GitLab