From 4ff8136807530b8970db51e25c3565f006b8a902 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 8 Jan 2015 02:32:34 -0800 Subject: [PATCH] Removed remaining profile calls Change-Id: I31c81c78715048004fc8fca0f27d09c1fa71c118 --- api.php | 2 - img_auth.php | 2 - includes/EditPage.php | 26 ---------- includes/FeedUtils.php | 2 - includes/HtmlFormatter.php | 6 --- includes/HttpFunctions.php | 2 - includes/Linker.php | 4 -- includes/MediaWiki.php | 3 -- includes/StreamFile.php | 2 - includes/StubObject.php | 3 -- includes/User.php | 2 - includes/WebStart.php | 4 -- includes/Xml.php | 2 - includes/cache/LocalisationCache.php | 8 ---- includes/cache/MessageCache.php | 4 -- includes/context/RequestContext.php | 2 - includes/db/DatabaseMysqlBase.php | 3 -- includes/deferred/SearchUpdate.php | 2 - includes/diff/DifferenceEngine.php | 4 -- includes/filebackend/FileBackendStore.php | 10 ---- includes/filebackend/SwiftFileBackend.php | 2 - includes/filerepo/file/File.php | 2 - includes/filerepo/file/LocalFile.php | 10 ---- includes/jobqueue/JobRunner.php | 2 - includes/media/Bitmap.php | 6 --- includes/media/DjVu.php | 2 - includes/media/DjVuImage.php | 6 --- includes/media/Jpeg.php | 2 - includes/media/SVG.php | 2 - includes/parser/LinkHolderArray.php | 6 --- includes/parser/Parser.php | 47 ------------------- includes/parser/Preprocessor_DOM.php | 9 ---- includes/parser/Preprocessor_Hash.php | 9 ---- includes/resourceloader/ResourceLoader.php | 4 -- .../ResourceLoaderFileModule.php | 2 - includes/search/SearchHighlighter.php | 8 ---- includes/skins/SkinTemplate.php | 20 -------- includes/specials/SpecialAllMessages.php | 2 - includes/utils/MWCryptRand.php | 8 ---- includes/utils/StringUtils.php | 4 -- load.php | 2 - 41 files changed, 248 deletions(-) diff --git a/api.php b/api.php index 92e670475d..d63f2540db 100644 --- a/api.php +++ b/api.php @@ -42,7 +42,6 @@ if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.3 require __DIR__ . '/includes/WebStart.php'; -wfProfileIn( 'api.php' ); $starttime = microtime( true ); // URL safety checks @@ -94,7 +93,6 @@ DeferredUpdates::doUpdates(); // Log what the user did, for book-keeping purposes. $endtime = microtime( true ); -wfProfileOut( 'api.php' ); wfLogProfilingData(); diff --git a/img_auth.php b/img_auth.php index dcd171f94e..51470b6e6b 100644 --- a/img_auth.php +++ b/img_auth.php @@ -39,7 +39,6 @@ define( 'MW_NO_OUTPUT_COMPRESSION', 1 ); require __DIR__ . '/includes/WebStart.php'; -wfProfileIn( 'img_auth.php' ); # Set action base paths so that WebRequest::getPathInfo() # recognizes the "X" as the 'title' in ../img_auth.php/X urls. @@ -47,7 +46,6 @@ $wgArticlePath = false; # Don't let a "/*" article path clober our action path $wgActionPaths = array( "$wgUploadPath/" ); wfImageAuthMain(); -wfProfileOut( 'img_auth.php' ); wfLogProfilingData(); // Commit and close up! $factory = wfGetLBFactory(); diff --git a/includes/EditPage.php b/includes/EditPage.php index 6497c40619..8e433e4373 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -515,7 +515,6 @@ class EditPage { return; } - wfProfileIn( __METHOD__ . "-business-end" ); $this->isConflict = false; // css / js subpages of user pages get a special treatment @@ -537,7 +536,6 @@ class EditPage { if ( 'save' == $this->formtype ) { if ( !$this->attemptSave() ) { - wfProfileOut( __METHOD__ . "-business-end" ); return; } } @@ -547,7 +545,6 @@ class EditPage { if ( 'initial' == $this->formtype || $this->firsttime ) { if ( $this->initialiseForm() === false ) { $this->noSuchSectionPage(); - wfProfileOut( __METHOD__ . "-business-end" ); return; } @@ -560,7 +557,6 @@ class EditPage { } $this->showEditForm(); - wfProfileOut( __METHOD__ . "-business-end" ); } /** @@ -744,13 +740,10 @@ class EditPage { // Skip this if wpTextbox2 has input, it indicates that we came // from a conflict page with raw page text, not a custom form // modified by subclasses - wfProfileIn( get_class( $this ) . "::importContentFormData" ); $textbox1 = $this->importContentFormData( $request ); if ( $textbox1 !== null ) { $this->textbox1 = $textbox1; } - - wfProfileOut( get_class( $this ) . "::importContentFormData" ); } # Truncate for whole multibyte characters @@ -1526,13 +1519,11 @@ class EditPage { $status = Status::newGood(); - wfProfileIn( __METHOD__ . '-checks' ); if ( !Hooks::run( 'EditPage::attemptSave', array( $this ) ) ) { wfDebug( "Hook 'EditPage::attemptSave' aborted article saving\n" ); $status->fatal( 'hookaborted' ); $status->value = self::AS_HOOK_ERROR; - wfProfileOut( __METHOD__ . '-checks' ); return $status; } @@ -1549,7 +1540,6 @@ class EditPage { ); $status->fatal( 'spamprotectionmatch', false ); $status->value = self::AS_SPAM_ERROR; - wfProfileOut( __METHOD__ . '-checks' ); return $status; } @@ -1564,7 +1554,6 @@ class EditPage { $ex->getMessage() ); $status->value = self::AS_PARSE_ERROR; - wfProfileOut( __METHOD__ . '-checks' ); return $status; } @@ -1576,7 +1565,6 @@ class EditPage { $code = $wgUser->isAnon() ? self::AS_IMAGE_REDIRECT_ANON : self::AS_IMAGE_REDIRECT_LOGGED; $status->setResult( false, $code ); - wfProfileOut( __METHOD__ . '-checks' ); return $status; } @@ -1606,7 +1594,6 @@ class EditPage { wfDebugLog( 'SpamRegex', "$ip spam regex hit [[$pdbk]]: \"$match\"" ); $status->fatal( 'spamprotectionmatch', $match ); $status->value = self::AS_SPAM_ERROR; - wfProfileOut( __METHOD__ . '-checks' ); return $status; } if ( !Hooks::run( @@ -1616,13 +1603,11 @@ class EditPage { # Error messages etc. could be handled within the hook... $status->fatal( 'hookaborted' ); $status->value = self::AS_HOOK_ERROR; - wfProfileOut( __METHOD__ . '-checks' ); return $status; } elseif ( $this->hookError != '' ) { # ...or the hook could be expecting us to produce an error $status->fatal( 'hookaborted' ); $status->value = self::AS_HOOK_ERROR_EXPECTED; - wfProfileOut( __METHOD__ . '-checks' ); return $status; } @@ -1631,7 +1616,6 @@ class EditPage { $wgUser->spreadAnyEditBlock(); # Check block state against master, thus 'false'. $status->setResult( false, self::AS_BLOCKED_PAGE_FOR_USER ); - wfProfileOut( __METHOD__ . '-checks' ); return $status; } @@ -1640,19 +1624,16 @@ class EditPage { // Error will be displayed by showEditForm() $this->tooBig = true; $status->setResult( false, self::AS_CONTENT_TOO_BIG ); - wfProfileOut( __METHOD__ . '-checks' ); return $status; } if ( !$wgUser->isAllowed( 'edit' ) ) { if ( $wgUser->isAnon() ) { $status->setResult( false, self::AS_READ_ONLY_PAGE_ANON ); - wfProfileOut( __METHOD__ . '-checks' ); return $status; } else { $status->fatal( 'readonlytext' ); $status->value = self::AS_READ_ONLY_PAGE_LOGGED; - wfProfileOut( __METHOD__ . '-checks' ); return $status; } } @@ -1661,20 +1642,17 @@ class EditPage { && !$wgUser->isAllowed( 'editcontentmodel' ) ) { $status->setResult( false, self::AS_NO_CHANGE_CONTENT_MODEL ); - wfProfileOut( __METHOD__ . '-checks' ); return $status; } if ( wfReadOnly() ) { $status->fatal( 'readonlytext' ); $status->value = self::AS_READ_ONLY_PAGE; - wfProfileOut( __METHOD__ . '-checks' ); return $status; } if ( $wgUser->pingLimiter() || $wgUser->pingLimiter( 'linkpurge', 0 ) ) { $status->fatal( 'actionthrottledtext' ); $status->value = self::AS_RATE_LIMITED; - wfProfileOut( __METHOD__ . '-checks' ); return $status; } @@ -1682,11 +1660,9 @@ class EditPage { # confirmation if ( $this->wasDeletedSinceLastEdit() && !$this->recreate ) { $status->setResult( false, self::AS_ARTICLE_WAS_DELETED ); - wfProfileOut( __METHOD__ . '-checks' ); return $status; } - wfProfileOut( __METHOD__ . '-checks' ); # Load the page data from the master. If anything changes in the meantime, # we detect it by using page_latest like a token in a 1 try compare-and-swap. @@ -1859,7 +1835,6 @@ class EditPage { } # All's well - wfProfileIn( __METHOD__ . '-sectionanchor' ); $sectionanchor = ''; if ( $this->section == 'new' ) { $this->summary = $this->newSectionSummary( $sectionanchor ); @@ -1876,7 +1851,6 @@ class EditPage { } } $result['sectionanchor'] = $sectionanchor; - wfProfileOut( __METHOD__ . '-sectionanchor' ); // Save errors may fall down to the edit form, but we've now // merged the section into full text. Clear the section field diff --git a/includes/FeedUtils.php b/includes/FeedUtils.php index 7936b3748d..15fdbc59cc 100644 --- a/includes/FeedUtils.php +++ b/includes/FeedUtils.php @@ -127,7 +127,6 @@ class FeedUtils { } if ( $oldid ) { - wfProfileIn( __METHOD__ . "-dodiff" ); #$diffText = $de->getDiff( wfMessage( 'revisionasof', # $wgLang->timeanddate( $timestamp ), @@ -168,7 +167,6 @@ class FeedUtils { $diffText = UtfNormal::cleanUp( $diffText ); $diffText = self::applyDiffStyle( $diffText ); } - wfProfileOut( __METHOD__ . "-dodiff" ); } else { $rev = Revision::newFromId( $newid ); if ( $wgFeedDiffCutoff <= 0 || is_null( $rev ) ) { diff --git a/includes/HtmlFormatter.php b/includes/HtmlFormatter.php index 77b8d35b64..b2926d17bc 100644 --- a/includes/HtmlFormatter.php +++ b/includes/HtmlFormatter.php @@ -261,7 +261,6 @@ class HtmlFormatter { public function getText( $element = null ) { if ( $this->doc ) { - wfProfileIn( __METHOD__ . '-dom' ); if ( $element !== null && !( $element instanceof DOMElement ) ) { $element = $this->doc->getElementById( $element ); } @@ -277,9 +276,7 @@ class HtmlFormatter { $body->appendChild( $element ); } $html = $this->doc->saveHTML(); - wfProfileOut( __METHOD__ . '-dom' ); - wfProfileIn( __METHOD__ . '-fixes' ); $html = $this->fixLibXml( $html ); if ( wfIsWindows() ) { // Cleanup for CRLF misprocessing of unknown origin on Windows. @@ -288,7 +285,6 @@ class HtmlFormatter { // XML code paths if possible and fix there. $html = str_replace( ' ', '', $html ); } - wfProfileOut( __METHOD__ . '-fixes' ); } else { $html = $this->html; } @@ -296,12 +292,10 @@ class HtmlFormatter { $html = preg_replace( '/|^.*?|<\/body>.*$/s', '', $html ); $html = $this->onHtmlReady( $html ); - wfProfileIn( __METHOD__ . '-flatten' ); if ( $this->elementsToFlatten ) { $elements = implode( '|', $this->elementsToFlatten ); $html = preg_replace( "#]*>#is", '', $html ); } - wfProfileOut( __METHOD__ . '-flatten' ); return $html; } diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 3749b1cf1a..43dd2b2789 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -59,7 +59,6 @@ class Http { */ public static function request( $method, $url, $options = array() ) { wfDebug( "HTTP: $method: $url\n" ); - wfProfileIn( __METHOD__ . "-$method" ); $options['method'] = strtoupper( $method ); @@ -77,7 +76,6 @@ class Http { if ( $status->isOK() ) { $content = $req->getContent(); } - wfProfileOut( __METHOD__ . "-$method" ); return $content; } diff --git a/includes/Linker.php b/includes/Linker.php index b806619e18..7b7c21b4ad 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -218,7 +218,6 @@ class Linker { $target = self::normaliseSpecialPage( $target ); # If we don't know whether the page exists, let's find out. - wfProfileIn( __METHOD__ . '-checkPageExistence' ); if ( !in_array( 'known', $options ) && !in_array( 'broken', $options ) ) { if ( $target->isKnown() ) { $options[] = 'known'; @@ -226,7 +225,6 @@ class Linker { $options[] = 'broken'; } } - wfProfileOut( __METHOD__ . '-checkPageExistence' ); $oldquery = array(); if ( in_array( "forcearticlepath", $options ) && $query ) { @@ -319,7 +317,6 @@ class Linker { $defaults = array(); if ( !in_array( 'noclasses', $options ) ) { - wfProfileIn( __METHOD__ . '-getClasses' ); # Now build the classes. $classes = array(); @@ -340,7 +337,6 @@ class Linker { if ( $classes != array() ) { $defaults['class'] = implode( ' ', $classes ); } - wfProfileOut( __METHOD__ . '-getClasses' ); } # Get a default title attribute. diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 7adaca0ab9..3fe656e1d5 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -536,7 +536,6 @@ class MediaWiki { } if ( $this->config->get( 'UseFileCache' ) && $title->getNamespace() >= 0 ) { - wfProfileIn( 'main-try-filecache' ); if ( HTMLFileCache::useFileCache( $this->context ) ) { // Try low-level file cache hit $cache = new HTMLFileCache( $title, $action ); @@ -551,11 +550,9 @@ class MediaWiki { $this->context->getWikiPage()->doViewUpdates( $this->context->getUser() ); // Tell OutputPage that output is taken care of $this->context->getOutput()->disable(); - wfProfileOut( 'main-try-filecache' ); return; } } - wfProfileOut( 'main-try-filecache' ); } // Actually do the work of the request and build up any output diff --git a/includes/StreamFile.php b/includes/StreamFile.php index d69006e796..a52b25b02f 100644 --- a/includes/StreamFile.php +++ b/includes/StreamFile.php @@ -52,9 +52,7 @@ class StreamFile { if ( $res == self::NOT_MODIFIED ) { $ok = true; // use client cache } elseif ( $res == self::READY_STREAM ) { - wfProfileIn( __METHOD__ . '-send' ); $ok = readfile( $fname ); - wfProfileOut( __METHOD__ . '-send' ); } else { $ok = false; // failed } diff --git a/includes/StubObject.php b/includes/StubObject.php index adca862c93..2dfcdc2f49 100644 --- a/includes/StubObject.php +++ b/includes/StubObject.php @@ -150,10 +150,8 @@ class StubObject { if ( get_class( $GLOBALS[$this->global] ) != $this->class ) { $fname = __METHOD__ . '-' . $this->global; - wfProfileIn( $fname ); $caller = wfGetCaller( $level ); if ( ++$recursionLevel > 2 ) { - wfProfileOut( $fname ); throw new MWException( "Unstub loop detected on call of " . "\${$this->global}->$name from $caller\n" ); } @@ -161,7 +159,6 @@ class StubObject { . "\${$this->global}::$name from $caller\n" ); $GLOBALS[$this->global] = $this->_newObject(); --$recursionLevel; - wfProfileOut( $fname ); return $GLOBALS[$this->global]; } } diff --git a/includes/User.php b/includes/User.php index 62f7ec0cf0..0c6b15f3b0 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1706,7 +1706,6 @@ class User implements IDBAccessObject { } global $wgMemc; - wfProfileIn( __METHOD__ . '-' . $action ); $limits = $wgRateLimits[$action]; $keys = array(); @@ -1787,7 +1786,6 @@ class User implements IDBAccessObject { } } - wfProfileOut( __METHOD__ . '-' . $action ); return $triggered; } diff --git a/includes/WebStart.php b/includes/WebStart.php index bc1ca501f2..125e54430d 100644 --- a/includes/WebStart.php +++ b/includes/WebStart.php @@ -74,7 +74,6 @@ if ( file_exists( "$IP/StartProfiler.php" ) ) { require "$IP/StartProfiler.php"; } -wfProfileIn( 'WebStart.php-conf' ); # Load default settings require_once "$IP/includes/DefaultSettings.php"; @@ -107,9 +106,7 @@ if ( defined( 'MW_CONFIG_CALLBACK' ) ) { require_once MW_CONFIG_FILE; } -wfProfileOut( 'WebStart.php-conf' ); -wfProfileIn( 'WebStart.php-ob_start' ); # Initialise output buffering # Check that there is no previous output or previously set up buffers, because # that would cause us to potentially mix gzip and non-gzip output, creating a @@ -118,7 +115,6 @@ if ( ob_get_level() == 0 ) { require_once "$IP/includes/OutputHandler.php"; ob_start( 'wfOutputHandler' ); } -wfProfileOut( 'WebStart.php-ob_start' ); if ( !defined( 'MW_NO_SETUP' ) ) { require_once "$IP/includes/Setup.php"; diff --git a/includes/Xml.php b/includes/Xml.php index c07ac73bef..78b8715921 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -94,9 +94,7 @@ class Xml { $attribs = array_map( array( 'UtfNormal', 'cleanUp' ), $attribs ); } if ( $contents ) { - wfProfileIn( __METHOD__ . '-norm' ); $contents = $wgContLang->normalize( $contents ); - wfProfileOut( __METHOD__ . '-norm' ); } return self::element( $element, $attribs, $contents ); } diff --git a/includes/cache/LocalisationCache.php b/includes/cache/LocalisationCache.php index 16aedb2d5e..4da379b89b 100644 --- a/includes/cache/LocalisationCache.php +++ b/includes/cache/LocalisationCache.php @@ -257,9 +257,7 @@ class LocalisationCache { */ public function getItem( $code, $key ) { if ( !isset( $this->loadedItems[$code][$key] ) ) { - wfProfileIn( __METHOD__ . '-load' ); $this->loadItem( $code, $key ); - wfProfileOut( __METHOD__ . '-load' ); } if ( $key === 'fallback' && isset( $this->shallowFallbacks[$code] ) ) { @@ -280,9 +278,7 @@ class LocalisationCache { if ( !isset( $this->loadedSubitems[$code][$key][$subkey] ) && !isset( $this->loadedItems[$code][$key] ) ) { - wfProfileIn( __METHOD__ . '-load' ); $this->loadSubitem( $code, $key, $subkey ); - wfProfileOut( __METHOD__ . '-load' ); } if ( isset( $this->data[$code][$key][$subkey] ) ) { @@ -859,7 +855,6 @@ class LocalisationCache { $codeSequence = array_merge( array( $code ), $coreData['fallbackSequence'] ); $messageDirs = $this->getMessagesDirs(); - wfProfileIn( __METHOD__ . '-fallbacks' ); # Load non-JSON localisation data for extensions $extensionData = array_combine( @@ -957,7 +952,6 @@ class LocalisationCache { } } - wfProfileOut( __METHOD__ . '-fallbacks' ); # Add cache dependencies for any referenced globals $deps['wgExtensionMessagesFiles'] = new GlobalDependency( 'wgExtensionMessagesFiles' ); @@ -1014,7 +1008,6 @@ class LocalisationCache { } # Save to the persistent cache - wfProfileIn( __METHOD__ . '-write' ); $this->store->startWrite( $code ); foreach ( $allData as $key => $value ) { if ( in_array( $key, self::$splitKeys ) ) { @@ -1026,7 +1019,6 @@ class LocalisationCache { } } $this->store->finishWrite(); - wfProfileOut( __METHOD__ . '-write' ); # Clear out the MessageBlobStore # HACK: If using a null (i.e. disabled) storage backend, we diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 31f410e687..4f00cb2b8b 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -275,7 +275,6 @@ class MessageCache { # Hash of the contents is stored in memcache, to detect if local cache goes # out of date (e.g. due to replace() on some other server) if ( $wgUseLocalMessageCache ) { - wfProfileIn( __METHOD__ . '-fromlocal' ); $hash = $this->mMemc->get( wfMemcKey( 'messages', $code, 'hash' ) ); if ( $hash ) { @@ -291,7 +290,6 @@ class MessageCache { $this->mCache[$code] = $cache; } } - wfProfileOut( __METHOD__ . '-fromlocal' ); } if ( !$success ) { @@ -299,7 +297,6 @@ class MessageCache { # the lock can't be acquired, wait for the other thread to finish # and then try the global cache a second time. for ( $failedAttempts = 0; $failedAttempts < 2; $failedAttempts++ ) { - wfProfileIn( __METHOD__ . '-fromcache' ); $cache = $this->mMemc->get( $cacheKey ); if ( !$cache ) { $where[] = 'global cache is empty'; @@ -313,7 +310,6 @@ class MessageCache { $success = true; } - wfProfileOut( __METHOD__ . '-fromcache' ); if ( $success ) { # Done, no need to retry diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index a0e7f999d2..89ccd0b169 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -361,7 +361,6 @@ class RequestContext implements IContextSource { */ public function getSkin() { if ( $this->skin === null ) { - wfProfileIn( __METHOD__ . '-createskin' ); $skin = null; Hooks::run( 'RequestContextCreateSkin', array( $this, &$skin ) ); @@ -399,7 +398,6 @@ class RequestContext implements IContextSource { // After all that set a context on whatever skin got created $this->skin->setContext( $this ); - wfProfileOut( __METHOD__ . '-createskin' ); } return $this->skin; diff --git a/includes/db/DatabaseMysqlBase.php b/includes/db/DatabaseMysqlBase.php index 7cd55258b1..071bf96f3b 100644 --- a/includes/db/DatabaseMysqlBase.php +++ b/includes/db/DatabaseMysqlBase.php @@ -71,7 +71,6 @@ abstract class DatabaseMysqlBase extends DatabaseBase { $this->mPassword = $password; $this->mDBname = $dbName; - wfProfileIn( "dbconnect-$server" ); # The kernel's default SYN retransmission period is far too slow for us, # so we use a short timeout plus a manual retry. Retrying means that a small @@ -81,13 +80,11 @@ abstract class DatabaseMysqlBase extends DatabaseBase { try { $this->mConn = $this->mysqlConnect( $realServer ); } catch ( Exception $ex ) { - wfProfileOut( "dbconnect-$server" ); $this->restoreErrorHandler(); throw $ex; } $error = $this->restoreErrorHandler(); - wfProfileOut( "dbconnect-$server" ); # Always log connection errors if ( !$this->mConn ) { diff --git a/includes/deferred/SearchUpdate.php b/includes/deferred/SearchUpdate.php index 8de6974ed4..ff0d0aa753 100644 --- a/includes/deferred/SearchUpdate.php +++ b/includes/deferred/SearchUpdate.php @@ -123,7 +123,6 @@ class SearchUpdate implements DeferrableUpdate { $text = $wgContLang->normalizeForSearch( $text ); $lc = SearchEngine::legalSearchChars() . '&#;'; - wfProfileIn( __METHOD__ . '-regexps' ); $text = preg_replace( "/<\\/?\\s*[A-Za-z][^>]*?>/", ' ', $wgContLang->lc( " " . $text . " " ) ); # Strip HTML markup $text = preg_replace( "/(^|\\n)==\\s*([^\\n]+)\\s*==(\\s)/sD", @@ -170,7 +169,6 @@ class SearchUpdate implements DeferrableUpdate { # Strip wiki '' and ''' $text = preg_replace( "/''[']*/", " ", $text ); - wfProfileOut( __METHOD__ . '-regexps' ); return $text; } diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 3229719000..90a278572d 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -842,10 +842,8 @@ class DifferenceEngine extends ContextSource { if ( $wgExternalDiffEngine == 'wikidiff2' && function_exists( 'wikidiff2_do_diff' ) ) { # Better external diff engine, the 2 may some day be dropped # This one does the escaping and segmenting itself - wfProfileIn( 'wikidiff2_do_diff' ); $text = wikidiff2_do_diff( $otext, $ntext, 2 ); $text .= $this->debug( 'wikidiff2' ); - wfProfileOut( 'wikidiff2_do_diff' ); return $text; } @@ -870,10 +868,8 @@ class DifferenceEngine extends ContextSource { fclose( $tempFile1 ); fclose( $tempFile2 ); $cmd = wfEscapeShellArg( $wgExternalDiffEngine, $tempName1, $tempName2 ); - wfProfileIn( __METHOD__ . "-shellexec" ); $difftext = wfShellExec( $cmd ); $difftext .= $this->debug( "external $wgExternalDiffEngine" ); - wfProfileOut( __METHOD__ . "-shellexec" ); unlink( $tempName1 ); unlink( $tempName2 ); diff --git a/includes/filebackend/FileBackendStore.php b/includes/filebackend/FileBackendStore.php index 23d9f731f4..a3b0009b8a 100644 --- a/includes/filebackend/FileBackendStore.php +++ b/includes/filebackend/FileBackendStore.php @@ -644,9 +644,7 @@ abstract class FileBackendStore extends FileBackend { } } } - wfProfileIn( __METHOD__ . '-miss-' . $this->name ); $stat = $this->doGetFileStat( $params ); - wfProfileOut( __METHOD__ . '-miss-' . $this->name ); if ( is_array( $stat ) ) { // file exists // Strongly consistent backends can automatically set "latest" $stat['latest'] = isset( $stat['latest'] ) ? $stat['latest'] : $latest; @@ -718,12 +716,8 @@ abstract class FileBackendStore extends FileBackend { return $stat['map']; } } - wfProfileIn( __METHOD__ . '-miss' ); - wfProfileIn( __METHOD__ . '-miss-' . $this->name ); $fields = $this->doGetFileXAttributes( $params ); $fields = is_array( $fields ) ? self::normalizeXAttributes( $fields ) : false; - wfProfileOut( __METHOD__ . '-miss-' . $this->name ); - wfProfileOut( __METHOD__ . '-miss' ); $this->cheapCache->set( $path, 'xattr', array( 'map' => $fields, 'latest' => $latest ) ); return $fields; @@ -752,9 +746,7 @@ abstract class FileBackendStore extends FileBackend { return $stat['hash']; } } - wfProfileIn( __METHOD__ . '-miss-' . $this->name ); $hash = $this->doGetFileSha1Base36( $params ); - wfProfileOut( __METHOD__ . '-miss-' . $this->name ); $this->cheapCache->set( $path, 'sha1', array( 'hash' => $hash, 'latest' => $latest ) ); return $hash; @@ -865,9 +857,7 @@ abstract class FileBackendStore extends FileBackend { if ( $res == StreamFile::NOT_MODIFIED ) { // do nothing; client cache is up to date } elseif ( $res == StreamFile::READY_STREAM ) { - wfProfileIn( __METHOD__ . '-send-' . $this->name ); $status = $this->doStreamFile( $params ); - wfProfileOut( __METHOD__ . '-send-' . $this->name ); if ( !$status->isOK() ) { // Per bug 41113, nasty things can happen if bad cache entries get // stuck in cache. It's also possible that this error can come up diff --git a/includes/filebackend/SwiftFileBackend.php b/includes/filebackend/SwiftFileBackend.php index 1f7ebc9a17..4fde1248e0 100644 --- a/includes/filebackend/SwiftFileBackend.php +++ b/includes/filebackend/SwiftFileBackend.php @@ -1285,13 +1285,11 @@ class SwiftFileBackend extends FileBackendStore { return null; } - wfProfileIn( __METHOD__ . "-{$this->name}-miss" ); list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( array( 'method' => 'HEAD', 'url' => $this->storageUrl( $auth, $container ), 'headers' => $this->authTokenHeaders( $auth ) ) ); - wfProfileOut( __METHOD__ . "-{$this->name}-miss" ); if ( $rcode === 204 ) { $stat = array( diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index cfb3e3d678..f8cc0077e7 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -1100,9 +1100,7 @@ abstract class File { } // Actually render the thumbnail... - wfProfileIn( __METHOD__ . '-doTransform' ); $thumb = $handler->doTransform( $this, $tmpThumbPath, $thumbUrl, $transformParams ); - wfProfileOut( __METHOD__ . '-doTransform' ); $tmpFile->bind( $thumb ); // keep alive with $thumb if ( !$thumb ) { // bad params? diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 30e31c39f9..47be4d2d52 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -1124,7 +1124,6 @@ class LocalFile extends File { } if ( !$props ) { - wfProfileIn( __METHOD__ . '-getProps' ); if ( $this->repo->isVirtualUrl( $srcPath ) || FileBackend::isStoragePath( $srcPath ) ) { @@ -1132,7 +1131,6 @@ class LocalFile extends File { } else { $props = FSFile::getPropsFromPath( $srcPath ); } - wfProfileOut( __METHOD__ . '-getProps' ); } $options = array(); @@ -1224,9 +1222,7 @@ class LocalFile extends File { $dbw->begin( __METHOD__ ); if ( !$props ) { - wfProfileIn( __METHOD__ . '-getProps' ); $props = $this->repo->getFileProps( $this->getVirtualUrl() ); - wfProfileOut( __METHOD__ . '-getProps' ); } # Imports or such might force a certain timestamp; otherwise we generate @@ -1382,7 +1378,6 @@ class LocalFile extends File { // Page exists, do RC entry now (otherwise we wait for later). $logEntry->publish( $logId ); } - wfProfileIn( __METHOD__ . '-edit' ); if ( $exists ) { # Create a null revision @@ -1449,22 +1444,17 @@ class LocalFile extends File { $dbw->commit( __METHOD__ ); // commit before anything bad can happen } - wfProfileOut( __METHOD__ . '-edit' ); if ( $reupload ) { # Delete old thumbnails - wfProfileIn( __METHOD__ . '-purge' ); $this->purgeThumbnails(); - wfProfileOut( __METHOD__ . '-purge' ); # Remove the old file from the squid cache SquidUpdate::purge( array( $this->getURL() ) ); } # Hooks, hooks, the magic of hooks... - wfProfileIn( __METHOD__ . '-hooks' ); Hooks::run( 'FileUpload', array( $this, $reupload, $descTitle->exists() ) ); - wfProfileOut( __METHOD__ . '-hooks' ); # Invalidate cache for all pages using this file $update = new HTMLCacheUpdate( $this->getTitle(), 'imagelinks' ); diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php index 8e8d69370b..ce3b3ffa03 100644 --- a/includes/jobqueue/JobRunner.php +++ b/includes/jobqueue/JobRunner.php @@ -129,7 +129,6 @@ class JobRunner { $this->runJobsLog( $job->toString() . " STARTING" ); // Run the job... - wfProfileIn( __METHOD__ . '-' . get_class( $job ) ); $jobStartTime = microtime( true ); try { ++$jobsRun; @@ -143,7 +142,6 @@ class JobRunner { MWExceptionHandler::logException( $e ); } $timeMs = intval( ( microtime( true ) - $jobStartTime ) * 1000 ); - wfProfileOut( __METHOD__ . '-' . get_class( $job ) ); $timeMsTotal += $timeMs; // Mark the job as done on success or when the job cannot be retried diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php index cd77f3e2ea..eadcf94ba8 100644 --- a/includes/media/Bitmap.php +++ b/includes/media/Bitmap.php @@ -169,10 +169,8 @@ class BitmapHandler extends TransformationalImageHandler { array( $this->escapeMagickOutput( $params['dstPath'] ) ) ) ); wfDebug( __METHOD__ . ": running ImageMagick: $cmd\n" ); - wfProfileIn( 'convert' ); $retval = 0; $err = wfShellExecWithStderr( $cmd, $retval, $env ); - wfProfileOut( 'convert' ); if ( $retval !== 0 ) { $this->logErrorForExternalProcess( $retval, $err, $cmd ); @@ -280,10 +278,8 @@ class BitmapHandler extends TransformationalImageHandler { $cmd = str_replace( '%h', wfEscapeShellArg( $params['physicalHeight'] ), str_replace( '%w', wfEscapeShellArg( $params['physicalWidth'] ), $cmd ) ); # Size wfDebug( __METHOD__ . ": Running custom convert command $cmd\n" ); - wfProfileIn( 'convert' ); $retval = 0; $err = wfShellExecWithStderr( $cmd, $retval ); - wfProfileOut( 'convert' ); if ( $retval !== 0 ) { $this->logErrorForExternalProcess( $retval, $err, $cmd ); @@ -457,10 +453,8 @@ class BitmapHandler extends TransformationalImageHandler { " -rotate " . wfEscapeShellArg( "-$rotation" ) . " " . wfEscapeShellArg( $this->escapeMagickOutput( $params['dstPath'] ) ); wfDebug( __METHOD__ . ": running ImageMagick: $cmd\n" ); - wfProfileIn( 'convert' ); $retval = 0; $err = wfShellExecWithStderr( $cmd, $retval ); - wfProfileOut( 'convert' ); if ( $retval !== 0 ) { $this->logErrorForExternalProcess( $retval, $err, $cmd ); diff --git a/includes/media/DjVu.php b/includes/media/DjVu.php index 3072a62bb8..1b0eb492bb 100644 --- a/includes/media/DjVu.php +++ b/includes/media/DjVu.php @@ -221,11 +221,9 @@ class DjVuHandler extends ImageHandler { $cmd .= " | {$wgDjvuPostProcessor}"; } $cmd .= ' > ' . wfEscapeShellArg( $dstPath ) . ') 2>&1'; - wfProfileIn( 'ddjvu' ); wfDebug( __METHOD__ . ": $cmd\n" ); $retval = ''; $err = wfShellExec( $cmd, $retval ); - wfProfileOut( 'ddjvu' ); $removed = $this->removeBadFile( $dstPath, $retval ); if ( $retval != 0 || $removed ) { diff --git a/includes/media/DjVuImage.php b/includes/media/DjVuImage.php index 8ae60cc8fa..016728d05f 100644 --- a/includes/media/DjVuImage.php +++ b/includes/media/DjVuImage.php @@ -277,28 +277,22 @@ class DjVuImage { if ( isset( $wgDjvuDump ) ) { # djvudump is faster as of version 3.5 # http://sourceforge.net/tracker/index.php?func=detail&aid=1704049&group_id=32953&atid=406583 - wfProfileIn( 'djvudump' ); $cmd = wfEscapeShellArg( $wgDjvuDump ) . ' ' . wfEscapeShellArg( $this->mFilename ); $dump = wfShellExec( $cmd ); $xml = $this->convertDumpToXML( $dump ); - wfProfileOut( 'djvudump' ); } elseif ( isset( $wgDjvuToXML ) ) { - wfProfileIn( 'djvutoxml' ); $cmd = wfEscapeShellArg( $wgDjvuToXML ) . ' --without-anno --without-text ' . wfEscapeShellArg( $this->mFilename ); $xml = wfShellExec( $cmd ); - wfProfileOut( 'djvutoxml' ); } else { $xml = null; } # Text layer if ( isset( $wgDjvuTxt ) ) { - wfProfileIn( 'djvutxt' ); $cmd = wfEscapeShellArg( $wgDjvuTxt ) . ' --detail=page ' . wfEscapeShellArg( $this->mFilename ); wfDebug( __METHOD__ . ": $cmd\n" ); $retval = ''; $txt = wfShellExec( $cmd, $retval, array(), array( 'memory' => self::DJVUTXT_MEMORY_LIMIT ) ); - wfProfileOut( 'djvutxt' ); if ( $retval == 0 ) { # Strip some control characters $txt = preg_replace( "/[\013\035\037]/", "", $txt ); diff --git a/includes/media/Jpeg.php b/includes/media/Jpeg.php index fbdbdfe31e..810b9af608 100644 --- a/includes/media/Jpeg.php +++ b/includes/media/Jpeg.php @@ -143,10 +143,8 @@ class JpegHandler extends ExifBitmapHandler { " -outfile " . wfEscapeShellArg( $params['dstPath'] ) . " " . wfEscapeShellArg( $params['srcPath'] ); wfDebug( __METHOD__ . ": running jpgtran: $cmd\n" ); - wfProfileIn( 'jpegtran' ); $retval = 0; $err = wfShellExecWithStderr( $cmd, $retval ); - wfProfileOut( 'jpegtran' ); if ( $retval !== 0 ) { $this->logErrorForExternalProcess( $retval, $err, $cmd ); diff --git a/includes/media/SVG.php b/includes/media/SVG.php index 74e5e048a6..3e8d9e5e8b 100644 --- a/includes/media/SVG.php +++ b/includes/media/SVG.php @@ -272,10 +272,8 @@ class SvgHandler extends ImageHandler { $env['LANG'] = $lang; } - wfProfileIn( 'rsvg' ); wfDebug( __METHOD__ . ": $cmd\n" ); $err = wfShellExecWithStderr( $cmd, $retval, $env ); - wfProfileOut( 'rsvg' ); } } $removed = $this->removeBadFile( $dstPath, $retval ); diff --git a/includes/parser/LinkHolderArray.php b/includes/parser/LinkHolderArray.php index 5b6209eac1..0cc02098cd 100644 --- a/includes/parser/LinkHolderArray.php +++ b/includes/parser/LinkHolderArray.php @@ -289,7 +289,6 @@ class LinkHolderArray { $linkCache = LinkCache::singleton(); $output = $this->parent->getOutput(); - wfProfileIn( __METHOD__ . '-check' ); $dbr = wfGetDB( DB_SLAVE ); $threshold = $this->parent->getOptions()->getStubThreshold(); @@ -375,7 +374,6 @@ class LinkHolderArray { //pass an array of page_ids to an extension Hooks::run( 'GetLinkColours', array( $linkcolour_ids, &$colours ) ); } - wfProfileOut( __METHOD__ . '-check' ); # Do a second query for different language variants of links and categories if ( $wgContLang->hasVariants() ) { @@ -383,7 +381,6 @@ class LinkHolderArray { } # Construct search and replace arrays - wfProfileIn( __METHOD__ . '-construct' ); $replacePairs = array(); foreach ( $this->internals as $ns => $entries ) { foreach ( $entries as $index => $entry ) { @@ -419,17 +416,14 @@ class LinkHolderArray { } } $replacer = new HashtableReplacer( $replacePairs, 1 ); - wfProfileOut( __METHOD__ . '-construct' ); # Do the thing - wfProfileIn( __METHOD__ . '-replace' ); $text = preg_replace_callback( '/()/', $replacer->cb(), $text ); - wfProfileOut( __METHOD__ . '-replace' ); } /** diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 3027ab6efe..fcdf68cbc8 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -395,7 +395,6 @@ class Parser { global $wgShowHostnames; $fname = __METHOD__ . '-' . wfGetCaller(); - wfProfileIn( $fname ); if ( $clearState ) { $magicScopeVariable = $this->lock(); @@ -556,7 +555,6 @@ class Parser { $this->mRevisionSize = $oldRevisionSize; $this->mInputSize = false; $this->currentRevisionCache = null; - wfProfileOut( $fname ); return $this->mOutput; } @@ -2008,7 +2006,6 @@ class Parser { public function replaceInternalLinks2( &$s ) { global $wgExtraInterlanguageLinkPrefixes; - wfProfileIn( __METHOD__ . '-setup' ); static $tc = false, $e1, $e1_img; # the % is needed to support urlencoded titles as well if ( !$tc ) { @@ -2040,7 +2037,6 @@ class Parser { } if ( is_null( $this->mTitle ) ) { - wfProfileOut( __METHOD__ . '-setup' ); throw new MWException( __METHOD__ . ": \$this->mTitle is null\n" ); } $nottalk = !$this->mTitle->isTalkPage(); @@ -2057,7 +2053,6 @@ class Parser { } $useSubpages = $this->areSubpagesAllowed(); - wfProfileOut( __METHOD__ . '-setup' ); // @codingStandardsIgnoreStart Squiz.WhiteSpace.SemicolonSpacing.Incorrect # Loop for each link @@ -2073,7 +2068,6 @@ class Parser { } if ( $useLinkPrefixExtension ) { - wfProfileIn( __METHOD__ . '-prefixhandling' ); if ( preg_match( $e2, $s, $m ) ) { $prefix = $m[2]; $s = $m[1]; @@ -2085,12 +2079,10 @@ class Parser { $prefix = $first_prefix; $first_prefix = false; } - wfProfileOut( __METHOD__ . '-prefixhandling' ); } $might_be_img = false; - wfProfileIn( __METHOD__ . "-e1" ); if ( preg_match( $e1, $line, $m ) ) { # page with normal text or alt $text = $m[2]; # If we get a ] at the beginning of $m[3] that means we have a link that's something like: @@ -2124,11 +2116,8 @@ class Parser { $trail = ""; } else { # Invalid form; output directly $s .= $prefix . '[[' . $line; - wfProfileOut( __METHOD__ . "-e1" ); continue; } - wfProfileOut( __METHOD__ . "-e1" ); - wfProfileIn( __METHOD__ . "-misc" ); $origLink = $m[1]; @@ -2137,7 +2126,6 @@ class Parser { # should be external links. if ( preg_match( '/^(?i:' . $this->mUrlProtocols . ')/', $origLink ) ) { $s .= $prefix . '[[' . $line; - wfProfileOut( __METHOD__ . "-misc" ); continue; } @@ -2154,21 +2142,16 @@ class Parser { $link = substr( $link, 1 ); } - wfProfileOut( __METHOD__ . "-misc" ); - wfProfileIn( __METHOD__ . "-title" ); $nt = Title::newFromText( $this->mStripState->unstripNoWiki( $link ) ); if ( $nt === null ) { $s .= $prefix . '[[' . $line; - wfProfileOut( __METHOD__ . "-title" ); continue; } $ns = $nt->getNamespace(); $iw = $nt->getInterwiki(); - wfProfileOut( __METHOD__ . "-title" ); if ( $might_be_img ) { # if this is actually an invalid link - wfProfileIn( __METHOD__ . "-might_be_img" ); if ( $ns == NS_FILE && $noforce ) { # but might be an image $found = false; while ( true ) { @@ -2200,16 +2183,13 @@ class Parser { $holders->merge( $this->replaceInternalLinks2( $text ) ); $s .= "{$prefix}[[$link|$text"; # note: no $trail, because without an end, there *is* no trail - wfProfileOut( __METHOD__ . "-might_be_img" ); continue; } } else { # it's not an image, so output it raw $s .= "{$prefix}[[$link|$text"; # note: no $trail, because without an end, there *is* no trail - wfProfileOut( __METHOD__ . "-might_be_img" ); continue; } - wfProfileOut( __METHOD__ . "-might_be_img" ); } $wasblank = ( $text == '' ); @@ -2226,7 +2206,6 @@ class Parser { # Link not escaped by : , create the various objects if ( $noforce && !$nt->wasLocalInterwiki() ) { # Interwikis - wfProfileIn( __METHOD__ . "-interwiki" ); if ( $iw && $this->mOptions->getInterwikiMagic() && $nottalk && ( Language::fetchLanguageName( $iw, null, 'mw' ) || @@ -2241,13 +2220,10 @@ class Parser { $s = rtrim( $s . $prefix ); $s .= trim( $trail, "\n" ) == '' ? '': $prefix . $trail; - wfProfileOut( __METHOD__ . "-interwiki" ); continue; } - wfProfileOut( __METHOD__ . "-interwiki" ); if ( $ns == NS_FILE ) { - wfProfileIn( __METHOD__ . "-image" ); if ( !wfIsBadImage( $nt->getDBkey(), $this->mTitle ) ) { if ( $wasblank ) { # if no parameters were passed, $text @@ -2268,12 +2244,10 @@ class Parser { } else { $s .= $prefix . $trail; } - wfProfileOut( __METHOD__ . "-image" ); continue; } if ( $ns == NS_CATEGORY ) { - wfProfileIn( __METHOD__ . "-category" ); $s = rtrim( $s . "\n" ); # bug 87 if ( $wasblank ) { @@ -2291,7 +2265,6 @@ class Parser { */ $s .= trim( $prefix . $trail, "\n" ) == '' ? '' : $prefix . $trail; - wfProfileOut( __METHOD__ . "-category" ); continue; } } @@ -2307,7 +2280,6 @@ class Parser { # NS_MEDIA is a pseudo-namespace for linking directly to a file # @todo FIXME: Should do batch file existence checks, see comment below if ( $ns == NS_MEDIA ) { - wfProfileIn( __METHOD__ . "-media" ); # Give extensions a chance to select the file revision for us $options = array(); $descQuery = false; @@ -2318,11 +2290,9 @@ class Parser { # Cloak with NOPARSE to avoid replacement in replaceExternalLinks $s .= $prefix . $this->armorLinks( Linker::makeMediaLinkFile( $nt, $file, $text ) ) . $trail; - wfProfileOut( __METHOD__ . "-media" ); continue; } - wfProfileIn( __METHOD__ . "-always_known" ); # Some titles, such as valid special pages or files in foreign repos, should # be shown as bluelinks even though they're not included in the page table # @@ -2335,7 +2305,6 @@ class Parser { # Links will be added to the output link list after checking $s .= $holders->makeHolder( $nt, $text, array(), $trail, $prefix ); } - wfProfileOut( __METHOD__ . "-always_known" ); } return $holders; } @@ -2643,7 +2612,6 @@ class Parser { # If we have no prefixes, go to paragraph mode. if ( 0 == $prefixLength ) { - wfProfileIn( __METHOD__ . "-paragraph" ); # No prefix (not in list)--go to paragraph mode # XXX: use a stack for nestable elements like span, table and div $openmatch = preg_match( @@ -2712,7 +2680,6 @@ class Parser { } } } - wfProfileOut( __METHOD__ . "-paragraph" ); } # somewhere above we forget to get out of pre block (bug 785) if ( $preCloseMatch && $this->mInPre ) { @@ -3430,7 +3397,6 @@ class Parser { * @return string The text of the template */ public function braceSubstitution( $piece, $frame ) { - wfProfileIn( __METHOD__ . '-setup' ); // Flags @@ -3463,12 +3429,10 @@ class Parser { # @todo FIXME: If piece['parts'] is null then the call to getLength() # below won't work b/c this $args isn't an object $args = ( null == $piece['parts'] ) ? array() : $piece['parts']; - wfProfileOut( __METHOD__ . '-setup' ); $profileSection = null; // profile templates # SUBST - wfProfileIn( __METHOD__ . '-modifiers' ); if ( !$found ) { $substMatch = $this->mSubstWords->matchStartAndRemove( $part1 ); @@ -3525,11 +3489,9 @@ class Parser { $forceRawInterwiki = true; } } - wfProfileOut( __METHOD__ . '-modifiers' ); # Parser functions if ( !$found ) { - wfProfileIn( __METHOD__ . '-pfunc' ); $colonPos = strpos( $part1, ':' ); if ( $colonPos !== false ) { @@ -3541,7 +3503,6 @@ class Parser { try { $result = $this->callParserFunction( $frame, $func, $funcArgs ); } catch ( Exception $ex ) { - wfProfileOut( __METHOD__ . '-pfunc' ); throw $ex; } @@ -3550,7 +3511,6 @@ class Parser { # here. extract( $result ); } - wfProfileOut( __METHOD__ . '-pfunc' ); } # Finish mangling title and then check for loops. @@ -3586,7 +3546,6 @@ class Parser { # Load from database if ( !$found && $title ) { $profileSection = $this->mProfiler->scopedProfileIn( $title->getPrefixedDBkey() ); - wfProfileIn( __METHOD__ . '-loadtpl' ); if ( !$title->isExternal() ) { if ( $title->isSpecialPage() && $this->mOptions->getAllowSpecialInclusion() @@ -3660,7 +3619,6 @@ class Parser { . ''; wfDebug( __METHOD__ . ": template loop broken at '$titleText'\n" ); } - wfProfileOut( __METHOD__ . '-loadtpl' ); } # If we haven't found text to substitute by now, we're done @@ -3774,12 +3732,10 @@ class Parser { } } - wfProfileIn( __METHOD__ . '-pfunc-' . $function ); list( $callback, $flags ) = $this->mFunctionHooks[$function]; # Workaround for PHP bug 35229 and similar if ( !is_callable( $callback ) ) { - wfProfileOut( __METHOD__ . '-pfunc-' . $function ); throw new MWException( "Tag hook for $function is not callable\n" ); } @@ -3844,7 +3800,6 @@ class Parser { $result['text'] = $this->preprocessToDom( $result['text'], $preprocessFlags ); $result['isChildObj'] = true; } - wfProfileOut( __METHOD__ . '-pfunc-' . $function ); return $result; } @@ -5399,7 +5354,6 @@ class Parser { $file = $this->fetchFileNoRegister( $title, $options ); $handler = $file ? $file->getHandler() : false; - wfProfileIn( __METHOD__ . '-getMagicWord' ); $paramMap = array( 'img_alt' => 'gallery-internal-alt', 'img_link' => 'gallery-internal-link', @@ -5412,7 +5366,6 @@ class Parser { } $mwArray = new MagicWordArray( array_keys( $paramMap ) ); - wfProfileOut( __METHOD__ . '-getMagicWord' ); $label = ''; $alt = ''; diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index e642c960bf..5b7196877d 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -86,7 +86,6 @@ class Preprocessor_DOM implements Preprocessor { $xml .= ""; - wfProfileIn( __METHOD__ . '-loadXML' ); $dom = new DOMDocument(); wfSuppressWarnings(); $result = $dom->loadXML( $xml ); @@ -98,7 +97,6 @@ class Preprocessor_DOM implements Preprocessor { // don't barf when the XML is >256 levels deep $result = $dom->loadXML( $xml, 1 << 19 ); } - wfProfileOut( __METHOD__ . '-loadXML' ); if ( !$result ) { throw new MWException( 'Parameters passed to ' . __METHOD__ . ' result in invalid XML' ); @@ -156,7 +154,6 @@ class Preprocessor_DOM implements Preprocessor { $cacheable = ( $wgPreprocessorCacheThreshold !== false && strlen( $text ) > $wgPreprocessorCacheThreshold ); if ( $cacheable ) { - wfProfileIn( __METHOD__ . '-cacheable' ); $cacheKey = wfMemcKey( 'preprocess-xml', md5( $text ), $flags ); $cacheValue = $wgMemc->get( $cacheKey ); @@ -169,11 +166,9 @@ class Preprocessor_DOM implements Preprocessor { } } if ( $xml === false ) { - wfProfileIn( __METHOD__ . '-cache-miss' ); $xml = $this->preprocessToXml( $text, $flags ); $cacheValue = sprintf( "%08d", self::CACHE_VERSION ) . $xml; $wgMemc->set( $cacheKey, $cacheValue, 86400 ); - wfProfileOut( __METHOD__ . '-cache-miss' ); wfDebugLog( "Preprocessor", "Saved preprocessor XML to memcached (key $cacheKey)" ); } } else { @@ -186,12 +181,10 @@ class Preprocessor_DOM implements Preprocessor { $max = $this->parser->mOptions->getMaxGeneratedPPNodeCount(); if ( $this->parser->mGeneratedPPNodeCount > $max ) { if ( $cacheable ) { - wfProfileOut( __METHOD__ . '-cacheable' ); } throw new MWException( __METHOD__ . ': generated node count limit exceeded' ); } - wfProfileIn( __METHOD__ . '-loadXML' ); $dom = new DOMDocument; wfSuppressWarnings(); $result = $dom->loadXML( $xml ); @@ -206,10 +199,8 @@ class Preprocessor_DOM implements Preprocessor { if ( $result ) { $obj = new PPNode_DOM( $dom->documentElement ); } - wfProfileOut( __METHOD__ . '-loadXML' ); if ( $cacheable ) { - wfProfileOut( __METHOD__ . '-cacheable' ); } diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index 4de2fed55f..af91ad47fb 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -120,7 +120,6 @@ class Preprocessor_Hash implements Preprocessor { && strlen( $text ) > $wgPreprocessorCacheThreshold; if ( $cacheable ) { - wfProfileIn( __METHOD__ . '-cacheable' ); $cacheKey = wfMemcKey( 'preprocess-hash', md5( $text ), $flags ); $cacheValue = $wgMemc->get( $cacheKey ); @@ -131,11 +130,9 @@ class Preprocessor_Hash implements Preprocessor { // From the cache wfDebugLog( "Preprocessor", "Loaded preprocessor hash from memcached (key $cacheKey)" ); - wfProfileOut( __METHOD__ . '-cacheable' ); return $hash; } } - wfProfileIn( __METHOD__ . '-cache-miss' ); } $rules = array( @@ -635,15 +632,11 @@ class Preprocessor_Hash implements Preprocessor { } if ( !$node ) { if ( $cacheable ) { - wfProfileOut( __METHOD__ . '-cache-miss' ); - wfProfileOut( __METHOD__ . '-cacheable' ); } throw new MWException( __METHOD__ . ': eqpos not found' ); } if ( $node->name !== 'equals' ) { if ( $cacheable ) { - wfProfileOut( __METHOD__ . '-cache-miss' ); - wfProfileOut( __METHOD__ . '-cacheable' ); } throw new MWException( __METHOD__ . ': eqpos is not equals' ); } @@ -744,8 +737,6 @@ class Preprocessor_Hash implements Preprocessor { if ( $cacheable ) { $cacheValue = sprintf( "%08d", self::CACHE_VERSION ) . serialize( $rootNode ); $wgMemc->set( $cacheKey, $cacheValue, 86400 ); - wfProfileOut( __METHOD__ . '-cache-miss' ); - wfProfileOut( __METHOD__ . '-cacheable' ); wfDebugLog( "Preprocessor", "Saved preprocessor Hash to memcached (key $cacheKey)" ); } diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 5ee9fdba06..aecd827474 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -595,7 +595,6 @@ class ResourceLoader { $this->errors[] = self::formatExceptionNoComment( $e ); } - wfProfileIn( __METHOD__ . '-getModifiedTime' ); // To send Last-Modified and support If-Modified-Since, we need to detect // the last modified time @@ -614,7 +613,6 @@ class ResourceLoader { } } - wfProfileOut( __METHOD__ . '-getModifiedTime' ); // If there's an If-Modified-Since header, respond with a 304 appropriately if ( $this->tryRespondLastModified( $context, $mtime ) ) { @@ -902,7 +900,6 @@ class ResourceLoader { * @var $module ResourceLoaderModule */ - wfProfileIn( __METHOD__ . '-' . $name ); try { $scripts = ''; if ( $context->shouldIncludeScripts() ) { @@ -1016,7 +1013,6 @@ class ResourceLoader { unset( $modules[$name] ); } $isRaw |= $module->isRaw(); - wfProfileOut( __METHOD__ . '-' . $name ); } // Update module states diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index c4210349fe..fbca08e8f7 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -569,9 +569,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { return $this->modifiedTime[$context->getHash()]; } - wfProfileIn( __METHOD__ . '-filemtime' ); $filesMtime = max( array_map( array( __CLASS__, 'safeFilemtime' ), $files ) ); - wfProfileOut( __METHOD__ . '-filemtime' ); $this->modifiedTime[$context->getHash()] = max( $filesMtime, diff --git a/includes/search/SearchHighlighter.php b/includes/search/SearchHighlighter.php index c3c3a8f86f..1641fb9275 100644 --- a/includes/search/SearchHighlighter.php +++ b/includes/search/SearchHighlighter.php @@ -67,7 +67,6 @@ class SearchHighlighter { $spat .= '/'; $textExt = array(); // text extracts $otherExt = array(); // other extracts - wfProfileIn( "$fname-split" ); $start = 0; $textLen = strlen( $text ); $count = 0; // sequence number to maintain ordering @@ -132,7 +131,6 @@ class SearchHighlighter { $all = $textExt + $otherExt; // these have disjunct key sets - wfProfileOut( "$fname-split" ); // prepare regexps foreach ( $terms as $index => $term ) { @@ -163,7 +161,6 @@ class SearchHighlighter { $pat1 = "/(" . $phrase . ")/ui"; $pat2 = "/$patPre(" . $anyterm . ")$patPost/ui"; - wfProfileIn( "$fname-extract" ); $left = $contextlines; @@ -287,7 +284,6 @@ class SearchHighlighter { } } - wfProfileOut( "$fname-extract" ); return $extract; } @@ -452,7 +448,6 @@ class SearchHighlighter { */ function removeWiki( $text ) { $fname = __METHOD__; - wfProfileIn( $fname ); // $text = preg_replace( "/'{2,5}/", "", $text ); // $text = preg_replace( "/\[[a-z]+:\/\/[^ ]+ ([^]]+)\]/", "\\2", $text ); @@ -474,7 +469,6 @@ class SearchHighlighter { $text = preg_replace( "/('''|<\/?[iIuUbB]>)/", "", $text ); $text = preg_replace( "/''/", "", $text ); - wfProfileOut( $fname ); return $text; } @@ -523,7 +517,6 @@ class SearchHighlighter { $lineno = 0; $extract = ""; - wfProfileIn( "$fname-extract" ); foreach ( $lines as $line ) { if ( 0 == $contextlines ) { break; @@ -551,7 +544,6 @@ class SearchHighlighter { $extract .= "${line}\n"; } - wfProfileOut( "$fname-extract" ); return $extract; } diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php index 960f1c1b1f..f60e4e8ad4 100644 --- a/includes/skins/SkinTemplate.php +++ b/includes/skins/SkinTemplate.php @@ -180,11 +180,8 @@ class SkinTemplate extends Skin { $user = $this->getUser(); $title = $this->getTitle(); - wfProfileIn( __METHOD__ . '-init' ); $tpl = $this->setupTemplate( $this->template, 'skins' ); - wfProfileOut( __METHOD__ . '-init' ); - wfProfileIn( __METHOD__ . '-stuff' ); $this->thispage = $title->getPrefixedDBkey(); $this->titletxt = $title->getPrefixedText(); $this->userpage = $user->getUserPage()->getPrefixedText(); @@ -207,7 +204,6 @@ class SkinTemplate extends Skin { $this->userpageUrlDetails = self::makeKnownUrlDetails( $this->userpage ); } - wfProfileOut( __METHOD__ . '-stuff' ); return $tpl; @@ -231,14 +227,10 @@ class SkinTemplate extends Skin { $out = $this->getOutput(); - wfProfileIn( __METHOD__ . '-init' ); $this->initPage( $out ); - wfProfileOut( __METHOD__ . '-init' ); $tpl = $this->prepareQuickTemplate( $out ); // execute template - wfProfileIn( __METHOD__ . '-execute' ); $res = $tpl->execute(); - wfProfileOut( __METHOD__ . '-execute' ); // result may be an error $this->printOrError( $res ); @@ -267,7 +259,6 @@ class SkinTemplate extends Skin { $out = $this->getOutput(); $tpl = $this->setupTemplateForOutput(); - wfProfileIn( __METHOD__ . '-stuff2' ); $tpl->set( 'title', $out->getPageTitle() ); $tpl->set( 'pagetitle', $out->getHTMLTitle() ); $tpl->set( 'displaytitle', $out->mPageLinkTitle ); @@ -362,9 +353,7 @@ class SkinTemplate extends Skin { $tpl->set( 'userlangattributes', $attrs ); } - wfProfileOut( __METHOD__ . '-stuff2' ); - wfProfileIn( __METHOD__ . '-stuff3' ); $tpl->set( 'newtalk', $this->getNewtalks() ); $tpl->set( 'logo', $this->logoText() ); @@ -385,9 +374,7 @@ class SkinTemplate extends Skin { } $tpl->set( 'copyright', $this->getCopyright() ); } - wfProfileOut( __METHOD__ . '-stuff3' ); - wfProfileIn( __METHOD__ . '-stuff4' ); $tpl->set( 'copyrightico', $this->getCopyrightIcon() ); $tpl->set( 'poweredbyico', $this->getPoweredBy() ); $tpl->set( 'disclaimer', $this->disclaimerLink() ); @@ -458,9 +445,7 @@ class SkinTemplate extends Skin { } else { $tpl->set( 'language_urls', false ); } - wfProfileOut( __METHOD__ . '-stuff4' ); - wfProfileIn( __METHOD__ . '-stuff5' ); # Personal toolbar $tpl->set( 'personal_urls', $this->buildPersonalUrls() ); $content_navigation = $this->buildContentNavigationUrls(); @@ -500,7 +485,6 @@ class SkinTemplate extends Skin { // allow extensions adding stuff after the page content. // See Skin::afterContentHook() for further documentation. $tpl->set( 'dataAfterContent', $this->afterContentHook() ); - wfProfileOut( __METHOD__ . '-stuff5' ); return $tpl; } @@ -900,7 +884,6 @@ class SkinTemplate extends Skin { ); } - wfProfileIn( __METHOD__ . '-edit' ); // Checks if user can edit the current page if it exists or create it otherwise if ( $title->quickUserCan( 'edit', $user ) @@ -958,9 +941,7 @@ class SkinTemplate extends Skin { 'primary' => true, // don't collapse this in vector ); } - wfProfileOut( __METHOD__ . '-edit' ); - wfProfileIn( __METHOD__ . '-live' ); // Checks if the page exists if ( $title->exists() ) { // Adds history view link @@ -1021,7 +1002,6 @@ class SkinTemplate extends Skin { ); } - wfProfileOut( __METHOD__ . '-live' ); // Checks if the user is logged in if ( $this->loggedin && $user->isAllowedAll( 'viewmywatchlist', 'editmywatchlist' ) ) { diff --git a/includes/specials/SpecialAllMessages.php b/includes/specials/SpecialAllMessages.php index a6721f0f8a..8af02890bf 100644 --- a/includes/specials/SpecialAllMessages.php +++ b/includes/specials/SpecialAllMessages.php @@ -250,7 +250,6 @@ class AllMessagesTablePager extends TablePager { */ public static function getCustomisedStatuses( $messageNames, $langcode = 'en', $foreign = false ) { // FIXME: This function should be moved to Language:: or something. - wfProfileIn( __METHOD__ . '-db' ); $dbr = wfGetDB( DB_SLAVE ); $res = $dbr->select( 'page', @@ -286,7 +285,6 @@ class AllMessagesTablePager extends TablePager { } } - wfProfileOut( __METHOD__ . '-db' ); return array( 'pages' => $pageFlags, 'talks' => $talkFlags ); } diff --git a/includes/utils/MWCryptRand.php b/includes/utils/MWCryptRand.php index 5af4545914..15047c7110 100644 --- a/includes/utils/MWCryptRand.php +++ b/includes/utils/MWCryptRand.php @@ -313,7 +313,6 @@ class MWCryptRand { // entropy so this is also preferable to just trying to read urandom because it may work // on Windows systems as well. if ( function_exists( 'mcrypt_create_iv' ) ) { - wfProfileIn( __METHOD__ . '-mcrypt' ); $rem = $bytes - strlen( $buffer ); $iv = mcrypt_create_iv( $rem, MCRYPT_DEV_URANDOM ); if ( $iv === false ) { @@ -323,7 +322,6 @@ class MWCryptRand { wfDebug( __METHOD__ . ": mcrypt_create_iv generated " . strlen( $iv ) . " bytes of randomness.\n" ); } - wfProfileOut( __METHOD__ . '-mcrypt' ); } } @@ -336,7 +334,6 @@ class MWCryptRand { if ( function_exists( 'openssl_random_pseudo_bytes' ) && ( !wfIsWindows() || version_compare( PHP_VERSION, '5.3.4', '>=' ) ) ) { - wfProfileIn( __METHOD__ . '-openssl' ); $rem = $bytes - strlen( $buffer ); $openssl_bytes = openssl_random_pseudo_bytes( $rem, $openssl_strong ); if ( $openssl_bytes === false ) { @@ -352,7 +349,6 @@ class MWCryptRand { // using it use it's say on whether the randomness is strong $this->strong = !!$openssl_strong; } - wfProfileOut( __METHOD__ . '-openssl' ); } } @@ -360,7 +356,6 @@ class MWCryptRand { if ( strlen( $buffer ) < $bytes && ( function_exists( 'stream_set_read_buffer' ) || $forceStrong ) ) { - wfProfileIn( __METHOD__ . '-fopen-urandom' ); $rem = $bytes - strlen( $buffer ); if ( !function_exists( 'stream_set_read_buffer' ) && $forceStrong ) { wfDebug( __METHOD__ . ": Was forced to read from /dev/urandom " . @@ -399,7 +394,6 @@ class MWCryptRand { } else { wfDebug( __METHOD__ . ": /dev/urandom could not be opened.\n" ); } - wfProfileOut( __METHOD__ . '-fopen-urandom' ); } // If we cannot use or generate enough data from a secure source @@ -413,12 +407,10 @@ class MWCryptRand { ": Falling back to using a pseudo random state to generate randomness.\n" ); } while ( strlen( $buffer ) < $bytes ) { - wfProfileIn( __METHOD__ . '-fallback' ); $buffer .= $this->hmac( $this->randomState(), mt_rand() ); // This code is never really cryptographically strong, if we use it // at all, then set strong to false. $this->strong = false; - wfProfileOut( __METHOD__ . '-fallback' ); } // Once the buffer has been filled up with enough random data to fulfill diff --git a/includes/utils/StringUtils.php b/includes/utils/StringUtils.php index 86f45122bb..c71e315304 100644 --- a/includes/utils/StringUtils.php +++ b/includes/utils/StringUtils.php @@ -498,16 +498,12 @@ class ReplacementArray { */ function replace( $subject ) { if ( function_exists( 'fss_prep_replace' ) ) { - wfProfileIn( __METHOD__ . '-fss' ); if ( $this->fss === false ) { $this->fss = fss_prep_replace( $this->data ); } $result = fss_exec_replace( $this->fss, $subject ); - wfProfileOut( __METHOD__ . '-fss' ); } else { - wfProfileIn( __METHOD__ . '-strtr' ); $result = strtr( $subject, $this->data ); - wfProfileOut( __METHOD__ . '-strtr' ); } return $result; diff --git a/load.php b/load.php index 8b2390931d..f66cd5a8ec 100644 --- a/load.php +++ b/load.php @@ -31,7 +31,6 @@ if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.3 require __DIR__ . '/includes/WebStart.php'; -wfProfileIn( 'load.php' ); // URL safety checks if ( !$wgRequest->checkUrlExtension() ) { @@ -44,7 +43,6 @@ $configFactory = ConfigFactory::getDefaultInstance(); $resourceLoader = new ResourceLoader( $configFactory->makeConfig( 'main' ) ); $resourceLoader->respond( new ResourceLoaderContext( $resourceLoader, $wgRequest ) ); -wfProfileOut( 'load.php' ); wfLogProfilingData(); // Shut down the database. -- 2.20.1