log->trace( "." ); foreach( $this as $key => $toDestruct ) if ( isset( $this->$key ) ) unset( $this->$key ); parent::__destruct(); } //*/ public function start() { $this->tick(); $this->tickStart = DwTime::fSecondeToiMicroSeconde( \microtime( true ) // as float ); } public function stop() { $deltaTime = ( DwTime::fSecondeToiMicroSeconde( \microtime( true ) ) - $this->tickStart ); //if ( $deltaTime==0 ) // echo "deltaTime0 :$deltaTime\r\n"; $this->timeMeasures[] = $deltaTime; //array_push( // $this->timeMeasures // ,\( \microtime( true ) - $this->tickStart ) //); $this->tickStart = null; } public function printStats() : string { $strStats = ""; $strStats.="=== Execution Stats /Stats betwen Start/Stop\r\n"; //$strStats.="[time] |[last] |[frequence]\r\n"; $deltaTime = null; $minDeltaTime = null; $maxDeltaTime = null; $totalTime = 0; //us => 10^-6 s foreach( $this->timeMeasures as $cpt => $deltaTime ) { $totalTime += $deltaTime; if ( is_null( $minDeltaTime ) || $deltaTime < $minDeltaTime ) $minDeltaTime = $deltaTime; if ( is_null( $maxDeltaTime ) || $deltaTime > $maxDeltaTime ) $maxDeltaTime = $deltaTime; } if ( $cpt > 1 ) { if ( ! is_null( $minDeltaTime ) ) { $strStats.="MIN --------------------------------------\r\n"; $strStats.=$this->printMeasure( $minDeltaTime )."\r\n"; } if ( ! is_null( $maxDeltaTime ) ) { $strStats.="MAX --------------------------------------\r\n"; $strStats.=$this->printMeasure( $maxDeltaTime )."\r\n"; } if ( ! is_null( $totalTime ) ) { $cpt++; $strStats.="AVERAGE [{$cpt}]------------------------------\r\n"; $strStats.=$this->printMeasure( $totalTime/$cpt )."\r\n"; } } $strStats.="TOTAL --------------------------------------\r\n"; $strStats.=$this->printMeasure( $totalTime )."\r\n"; $strStats.="=== Call Stats / Stats betwen 2*Start\r\n"; $strStats.=parent::printStats(); return $strStats; } public function getClassName( bool $fqcn=null ) : string { return self::getStaticClassName( $fqcn ); } public static function getStaticClassName( bool $fqcn=null ) : string { return __CLASS__; } } ?>