From c5410557fe6f715e41f59bc0eba568de5907ea3c Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 22 Aug 2004 09:07:31 +0000 Subject: [PATCH] Add some profiling points --- index.php | 6 ++++++ languages/LanguageUtf8.php | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index ee3e56d51b..3ea90f6be8 100644 --- a/index.php +++ b/index.php @@ -60,6 +60,7 @@ if ( !is_null( $wgTitle ) && !$wgTitle->userCanRead() ) { exit; } +wfProfileIn( "main-action" ); if( $search = $wgRequest->getText( 'search' ) ) { require_once( 'SearchEngine.php' ); $wgTitle = Title::makeTitle( NS_SPECIAL, "Search" ); @@ -179,20 +180,25 @@ if( $search = $wgRequest->getText( 'search' ) ) { $wgOut->errorpage( "nosuchaction", "nosuchactiontext" ); } } +wfProfileOut( "main-action" ); # Deferred updates aren't really deferred anymore. It's important to report errors to the # user, and that means doing this before OutputPage::output(). Note that for page saves, # the client will wait until the script exits anyway before following the redirect. +wfProfileIn( "main-updates" ); foreach ( $wgDeferredUpdateList as $up ) { $up->doUpdate(); } +wfProfileOut( "main-updates" ); +wfProfileIn( "main-cleanup" ); $wgLoadBalancer->saveMasterPos(); # Now commit any transactions, so that unreported errors after output() don't roll back the whole thing $wgLoadBalancer->commitAll(); $wgOut->output(); +wfProfileOut( "main-cleanup" ); logProfilingData(); $wgLoadBalancer->closeAll(); diff --git a/languages/LanguageUtf8.php b/languages/LanguageUtf8.php index 8b86bd08fe..698efce716 100644 --- a/languages/LanguageUtf8.php +++ b/languages/LanguageUtf8.php @@ -61,18 +61,22 @@ class LanguageUtf8 extends Language { # all strtolower on stripped output or argument # should be removed and all stripForSearch # methods adjusted to that. + + wfProfileIn( "LanguageUtf8::stripForSearch" ); if( function_exists( 'mb_strtolower' ) ) { - return preg_replace( + $out = preg_replace( "/([\\xc0-\\xff][\\x80-\\xbf]*)/e", "'U8' . bin2hex( \"$1\" )", mb_strtolower( $string ) ); } else { global $wikiLowerChars; - return preg_replace( + $out = preg_replace( "/([\\xc0-\\xff][\\x80-\\xbf]*)/e", "'U8' . bin2hex( strtr( \"\$1\", \$wikiLowerChars ) )", $string ); } + wfProfileOut( "LanguageUtf8::stripForSearch" ); + return $out; } function fallback8bitEncoding() { -- 2.20.1