From 16e6b5474022b443fe248c2ba299b06b1fb5043e Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 8 Jan 2015 02:55:43 -0800 Subject: [PATCH] Switched API to using scopedProfileIn() Change-Id: Iaafad236c3e4c85e1b491e76f61322a266123ba6 --- includes/api/ApiBase.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 87c88fb0e7..3a31b2aeeb 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -2181,6 +2181,10 @@ abstract class ApiBase extends ContextSource { * Profiling: total module execution time */ private $mTimeIn = 0, $mModuleTime = 0; + /** @var ScopedCallback */ + private $profile; + /** @var ScopedCallback */ + private $dbProfile; /** * Get the name of the module as shown in the profiler log @@ -2205,7 +2209,7 @@ abstract class ApiBase extends ContextSource { ApiBase::dieDebug( __METHOD__, 'Called twice without calling profileOut()' ); } $this->mTimeIn = microtime( true ); - wfProfileIn( $this->getModuleProfileName() ); + $this->profile = Profiler::instance()->scopedProfileIn( $this->getModuleProfileName() ); } /** @@ -2224,7 +2228,7 @@ abstract class ApiBase extends ContextSource { $this->mModuleTime += microtime( true ) - $this->mTimeIn; $this->mTimeIn = 0; - wfProfileOut( $this->getModuleProfileName() ); + Profiler::instance()->scopedProfileOut( $this->profile ); } /** @@ -2271,7 +2275,8 @@ abstract class ApiBase extends ContextSource { ApiBase::dieDebug( __METHOD__, 'Called twice without calling profileDBOut()' ); } $this->mDBTimeIn = microtime( true ); - wfProfileIn( $this->getModuleProfileName( true ) ); + + $this->dbProfile = Profiler::instance()->scopedProfileIn( $this->getModuleProfileName( true ) ); } /** @@ -2291,7 +2296,7 @@ abstract class ApiBase extends ContextSource { $this->mDBTime += $time; $this->getMain()->mDBTime += $time; - wfProfileOut( $this->getModuleProfileName( true ) ); + Profiler::instance()->scopedProfileOut( $this->dbProfile ); } /** -- 2.20.1