From: Tim Starling Date: Sun, 19 Nov 2006 03:56:54 +0000 (+0000) Subject: UDP profiling X-Git-Tag: 1.31.0-rc.0~55148 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=0af04a048a7e3fe97127c30702f9d93154f92f45;p=lhc%2Fweb%2Fwiklou.git UDP profiling --- diff --git a/maintenance/dumpHTML.inc b/maintenance/dumpHTML.inc index 86f675c250..702c7df901 100644 --- a/maintenance/dumpHTML.inc +++ b/maintenance/dumpHTML.inc @@ -70,6 +70,9 @@ class DumpHTML { # Max page ID, lazy initialised var $maxPageID = false; + # UDP profiling + var $udpProfile, $udpProfileCounter = 0, $udpProfileInit = false; + function DumpHTML( $settings = array() ) { foreach ( $settings as $var => $value ) { $this->$var = $value; @@ -450,6 +453,8 @@ class DumpHTML { } } + $this->profile(); + $this->rawPages = array(); $text = $this->getArticleHTML( $title ); @@ -958,7 +963,33 @@ ENDTEXT; } return $this->maxPageID; } - + + function profile() { + global $wgProfiler; + + if ( !$this->udpProfile ) { + return; + } + if ( !$this->udpProfileInit ) { + $this->udpProfileInit = true; + } elseif ( $this->udpProfileCounter == 1 % $this->udpProfile ) { + $wgProfiler->getFunctionReport(); + $wgProfiler = new DumpHTML_ProfilerStub; + } + if ( $this->udpProfileCounter == 0 ) { + $wgProfiler = new ProfilerSimpleUDP; + $wgProfiler->setProfileID( 'dumpHTML' ); + } + $this->udpProfileCounter = ( $this->udpProfileCounter + 1 ) % $this->udpProfile; + } +} + +class DumpHTML_ProfilerStub { + function profileIn() {} + function profileOut() {} + function getOutput() {} + function close() {} + function getFunctionReport() {} } /** XML parser callback */