http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97690
Revision: 97690
Author: tstarling
Date: 2011-09-21 02:12:32 +0000 (Wed, 21 Sep 2011)
Log Message:
-----------
MFT r97614: fixed ProfilerSimple double-counting of -total
Modified Paths:
--------------
branches/wmf/1.18wmf1/includes/profiler/ProfilerSimple.php
Property Changed:
----------------
branches/wmf/1.18wmf1/includes/profiler/ProfilerSimple.php
Modified: branches/wmf/1.18wmf1/includes/profiler/ProfilerSimple.php
===================================================================
--- branches/wmf/1.18wmf1/includes/profiler/ProfilerSimple.php 2011-09-21
01:38:54 UTC (rev 97689)
+++ branches/wmf/1.18wmf1/includes/profiler/ProfilerSimple.php 2011-09-21
02:12:32 UTC (rev 97690)
@@ -12,10 +12,20 @@
class ProfilerSimple extends Profiler {
var $mMinimumTime = 0;
+ var $zeroEntry = array('cpu'=> 0.0, 'cpu_sq' => 0.0, 'real' => 0.0,
'real_sq' => 0.0, 'count' => 0);
+ var $errorEntry;
+
function __construct( $params ) {
global $wgRequestTime, $wgRUstart;
parent::__construct( $params );
+
+ $this->errorEntry = $this->zeroEntry;
+ $this->errorEntry['count'] = 1;
+
if (!empty($wgRequestTime) && !empty($wgRUstart)) {
+ # Remove the -total entry from parent::__construct
+ $this->mWorkStack = array();
+
$this->mWorkStack[] = array( '-total', 0,
$wgRequestTime,$this->getCpuTime($wgRUstart));
$elapsedcpu = $this->getCpuTime() -
$this->getCpuTime($wgRUstart);
@@ -23,7 +33,7 @@
$entry =& $this->mCollated["-setup"];
if (!is_array($entry)) {
- $entry = array('cpu'=> 0.0, 'cpu_sq' => 0.0,
'real' => 0.0, 'real_sq' => 0.0, 'count' => 0);
+ $entry = $this->zeroEntry;
$this->mCollated["-setup"] =& $entry;
}
$entry['cpu'] += $elapsedcpu;
@@ -62,20 +72,18 @@
$message = "Profile section ended by close():
{$ofname}";
$functionname = $ofname;
$this->debug( "$message\n" );
- $this->mCollated[$message] = array(
- 'real' => 0.0, 'count' => 1);
+ $this->mCollated[$message] = $this->errorEntry;
}
elseif ($ofname != $functionname) {
$message = "Profiling error: in({$ofname}),
out($functionname)";
$this->debug( "$message\n" );
- $this->mCollated[$message] = array(
- 'real' => 0.0, 'count' => 1);
+ $this->mCollated[$message] = $this->errorEntry;
}
$entry =& $this->mCollated[$functionname];
$elapsedcpu = $this->getCpuTime() - $octime;
$elapsedreal = microtime(true) - $ortime;
if (!is_array($entry)) {
- $entry = array('cpu'=> 0.0, 'cpu_sq' => 0.0,
'real' => 0.0, 'real_sq' => 0.0, 'count' => 0);
+ $entry = $this->zeroEntry;
$this->mCollated[$functionname] =& $entry;
}
$entry['cpu'] += $elapsedcpu;
Property changes on: branches/wmf/1.18wmf1/includes/profiler/ProfilerSimple.php
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/REL1_15/phase3/includes/profiler/ProfilerSimple.php:51646
/branches/new-installer/phase3/includes/profiler/ProfilerSimple.php:43664-66004
/branches/sqlite/includes/profiler/ProfilerSimple.php:58211-58321
/branches/wmf-deployment/includes/profiler/ProfilerSimple.php:53381
/trunk/phase3/includes/profiler/ProfilerSimple.php:92580,92634,92713,92762,92765,92791,92854,92884,92886-92887,92894,92898,92907,92932,92958,93141,93149,93151,93233-93234,93258,93266,93303,93516-93518,93818-93822,93847,93858,93891,93935-93936,94058,94062,94068,94107,94155,94235,94277,94346,94372,94422,94425,94444,94448,94456,94498,94517,94601,94630,94728,94738,94825,94862,94995-94997,95023,95042,95072-95073,95155,95327,95332,95410,95422,95426,95442,95468,95601,95812,97590,97614
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs