PHPDocumentor [http://en.wikipedia.org/wiki/PhpDocumentor] documentation tweaking...
[lhc/web/wiklou.git] / includes / Profiler.php
index 78003e0..8307690 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 /**
  * This file is only included if profiling is enabled
- * @package MediaWiki
  */
 
 $wgProfiling = true;
@@ -41,14 +40,12 @@ if (!function_exists('memory_get_usage')) {
 
 /**
  * @todo document
- * @package MediaWiki
  */
 class Profiler {
        var $mStack = array (), $mWorkStack = array (), $mCollated = array ();
        var $mCalls = array (), $mTotals = array ();
 
-       function Profiler()
-       {
+       function __construct() {
                // Push an entry for the pre-profile setup time onto the stack
                global $wgRequestTime;
                if ( !empty( $wgRequestTime ) ) {
@@ -57,7 +54,6 @@ class Profiler {
                } else {
                        $this->profileIn( '-total' );
                }
-
        }
 
        function profileIn($functionname) {
@@ -164,7 +160,7 @@ class Profiler {
        }
 
        function getCallTreeLine($entry) {
-               list ($fname, $level, $start, $x, $end) = $entry;
+               list ($fname, $level, $start, /* $x */, $end) = $entry;
                $delta = $end - $start;
                $space = str_repeat(' ', $level);
 
@@ -208,7 +204,6 @@ class Profiler {
                # First, subtract the overhead!
                foreach ($this->mStack as $entry) {
                        $fname = $entry[0];
-                       $thislevel = $entry[1];
                        $start = $entry[2];
                        $end = $entry[4];
                        $elapsed = $end - $start;
@@ -229,7 +224,6 @@ class Profiler {
                # Collate
                foreach ($this->mStack as $index => $entry) {
                        $fname = $entry[0];
-                       $thislevel = $entry[1];
                        $start = $entry[2];
                        $end = $entry[4];
                        $elapsed = $end - $start;
@@ -293,7 +287,7 @@ class Profiler {
         * @return Integer
         * @private
         */
-       function calltreeCount($stack, $start) {
+       function calltreeCount($stack, $start) {
                $level = $stack[$start][1];
                $count = 0;
                for ($i = $start -1; $i >= 0 && $stack[$i][1] > $level; $i --) {
@@ -310,7 +304,7 @@ class Profiler {
                global $wguname, $wgProfilePerHost;
 
                $fname = 'Profiler::logToDB';
-               $dbw = wfGetDB(DB_MASTER);
+               $dbw = wfGetDB(DB_MASTER);
                if (!is_object($dbw))
                        return false;
                $errorState = $dbw->ignoreErrors( true );
@@ -351,7 +345,7 @@ class Profiler {
        }
        
        static function getCaller( $level ) {
-               $backtrace = debug_backtrace();
+               $backtrace = wfDebugBacktrace();
                if ( isset( $backtrace[$level] ) ) {
                        if ( isset( $backtrace[$level]['class'] ) ) {
                                $caller = $backtrace[$level]['class'] . '::' . $backtrace[$level]['function'];