Explorar o código

DebugExecutionTime add methods to fetch execute time

Piotr Labudda %!s(int64=11) %!d(string=hai) anos
pai
achega
41314b6f5d
Modificáronse 1 ficheiros con 16 adicións e 0 borrados
  1. 16 0
      SE/se-lib/DebugExecutionTime.php

+ 16 - 0
SE/se-lib/DebugExecutionTime.php

@@ -29,6 +29,22 @@ class DebugExecutionTime {
 		}
 	}
 
+	public function getLastExecTime() {
+		if (!$this->_isActive) return null;
+		$logTotal = count($this->_log);
+		if ($logTotal < 2) return null;
+		return $this->_log[$logTotal - 1][1];
+	}
+
+	public function getTotalExecTime() {
+		if (!$this->_isActive) return null;
+		$logTotal = count($this->_log);
+		if ($logTotal < 2) return null;
+		$sumExecTime = 0;
+		foreach ($this->_log as $log) $sumExecTime += $log[1];
+		return $sumExecTime;
+	}
+
 	public function printDebug() {
 		if (!$this->_isActive) return;
 		$sumExecTime = 0;