From: Yuri Astrakhan Date: Mon, 16 Oct 2006 23:25:51 +0000 (+0000) Subject: API * better profiler modules naming X-Git-Tag: 1.31.0-rc.0~55458 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=39fda46535d94bc4cf8e783632779e7f5a14abcd;p=lhc%2Fweb%2Fwiklou.git API * better profiler modules naming --- diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 466e25e5b6..8e1974bb81 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -52,12 +52,22 @@ abstract class ApiBase { public abstract function execute(); /** - * Get the name of the query being executed by this instance + * Get the name of the module being executed by this instance */ public function getModuleName() { return $this->mModuleName; } + /** + * Get the name of the module as shown in the profiler log + */ + public function getModuleProfileName($db = false) { + if ($db) + return 'API:' . $this->mModuleName . '-DB'; + else + return 'API:' . $this->mModuleName; + } + /** * Get main module */ @@ -394,7 +404,7 @@ abstract class ApiBase { if ($this->mTimeIn !== 0) ApiBase :: dieDebug(__METHOD__, 'called twice without calling profileOut()'); $this->mTimeIn = microtime(true); - wfProfileIn($this->getModuleName()); + wfProfileIn($this->getModuleProfileName()); } /** @@ -408,7 +418,7 @@ abstract class ApiBase { $this->mModuleTime += microtime(true) - $this->mTimeIn; $this->mTimeIn = 0; - wfProfileOut($this->getModuleName()); + wfProfileOut($this->getModuleProfileName()); } /** @@ -434,7 +444,7 @@ abstract class ApiBase { if ($this->mDBTimeIn !== 0) ApiBase :: dieDebug(__METHOD__, 'called twice without calling profileDBOut()'); $this->mDBTimeIn = microtime(true); - wfProfileIn($this->getModuleName() . '_db'); + wfProfileIn($this->getModuleProfileName(true)); } /** @@ -451,7 +461,7 @@ abstract class ApiBase { $this->mDBTime += $time; $this->getMain()->mDBTime += $time; - wfProfileOut($this->getModuleName() . '_db'); + wfProfileOut($this->getModuleProfileName(true)); } /**