MaxSem has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/64025


Change subject: Profiling
......................................................................

Profiling

Change-Id: I58ddea12fdae08102435874cc0ad6aba3108dd66
---
M includes/CarrierConfigStore.php
M includes/ConfigPageHooks.php
M includes/PageRenderingHooks.php
M includes/ZeroConfigContent.php
4 files changed, 25 insertions(+), 4 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ZeroRatedMobileAccess 
refs/changes/25/64025/1

diff --git a/includes/CarrierConfigStore.php b/includes/CarrierConfigStore.php
index 1512135..ebbc627 100644
--- a/includes/CarrierConfigStore.php
+++ b/includes/CarrierConfigStore.php
@@ -151,7 +151,10 @@
                if ( $uri === false ) {
                        return false;
                }
-               return $this->http->get( $uri, self::LOCK_TIMEOUT * 0.8 );
+               wfProfileIn( __METHOD__ );
+               $res = $this->http->get( $uri, self::LOCK_TIMEOUT * 0.8 );
+               wfProfileOut( __METHOD__ );
+               return $res;
        }
 
 
diff --git a/includes/ConfigPageHooks.php b/includes/ConfigPageHooks.php
index 3808c55..ba93198 100644
--- a/includes/ConfigPageHooks.php
+++ b/includes/ConfigPageHooks.php
@@ -60,6 +60,7 @@
        static function onEditFilterMerged( $editor, $text, &$error,
                                                                                
/** @noinspection PhpUnusedParameterInspection */
                                                                                
$summary ) {
+               wfProfileIn( __METHOD__ );
                if ( $editor->getTitle()->inNamespace( NS_ZERO ) ) {
                        $config = new CarrierConfig( $text );
                        if ( $config->isError() ) {
@@ -71,6 +72,7 @@
                                $error = $err;
                        }
                }
+               wfProfileOut( __METHOD__ );
                return true;
        }
 
diff --git a/includes/PageRenderingHooks.php b/includes/PageRenderingHooks.php
index c2aef24..f91a0b8 100644
--- a/includes/PageRenderingHooks.php
+++ b/includes/PageRenderingHooks.php
@@ -364,6 +364,8 @@
         * @return bool|String
         */
        private static function getBannerText( $config, $lang, $sitename ) {
+               wfProfileIn( __METHOD__ );
+
                if ( $lang === null ) {
                        global $wgLang;
                        $lang = $wgLang;
@@ -371,6 +373,7 @@
                $fallbacks = null;
                $name = self::pickLocalizedString( $config['name'], $lang, 
$fallbacks );
                if ( $name === false ) {
+                       wfProfileOut( __METHOD__ );
                        return false;
                }
                $nameMsg = new RawMessage( $name );
@@ -383,7 +386,10 @@
                        $linkText = str_replace( '{{SITENAME}}', $sitename, 
$linkText );
                }
                $linkTextMsg = new RawMessage( $linkText );
-               return $linkTextMsg->inLanguage( $lang )->rawParams( 
$nameMsg->inLanguage( $lang )->escaped() )->escaped();
+               $res = $linkTextMsg->inLanguage( $lang )->rawParams( 
$nameMsg->inLanguage( $lang )->escaped() )->escaped();
+
+               wfProfileOut( __METHOD__ );
+               return $res;
        }
 
 
diff --git a/includes/ZeroConfigContent.php b/includes/ZeroConfigContent.php
index d998d92..6081c4f 100644
--- a/includes/ZeroConfigContent.php
+++ b/includes/ZeroConfigContent.php
@@ -72,6 +72,8 @@
         * @return string: HTML.
         */
        private function objectTable( $config, $isTop = true ) {
+               wfProfileIn( __METHOD__ );
+
                $rows = array();
                $tdAttributes = array( 'class' => 'value' );
 
@@ -110,13 +112,18 @@
                        }
                        $rows[] = Xml::tags( 'tr', $attribs, $th . $td );
                }
-               return Xml::tags( 'table', array( 'class' => 'mw-zero-config' ),
+               $res = Xml::tags( 'table', array( 'class' => 'mw-zero-config' ),
                        Xml::tags( 'tbody', array(), join( "\n", $rows ) )
                );
+
+               wfProfileOut( __METHOD__ );
+               return $res;
        }
 
        private function renderBanners( $conf ) {
                global $wgConf;
+
+               wfProfileIn( __METHOD__ );
                $wgConf->loadFullData();
 
                // Merging keys preserves the order - first all the banners, 
then - name, etc
@@ -136,8 +143,11 @@
                                PageRenderingHooks::renderBanner( $conf, $lang, 
$sitename ) );
                        $rows[] = Xml::tags( 'tr', null, $th . $td );
                }
-               return Xml::tags( 'table', array( 'class' => 
'mw-zero-config-banners' ),
+               $res = Xml::tags( 'table', array( 'class' => 
'mw-zero-config-banners' ),
                        Xml::tags( 'tbody', array(), join( "\n", $rows ) )
                );
+
+               wfProfileOut( __METHOD__ );
+               return $res;
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/64025
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I58ddea12fdae08102435874cc0ad6aba3108dd66
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ZeroRatedMobileAccess
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to