r17060 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r17059‎ | r17060 | r17061 >
Date:23:25, 16 October 2006
Author:yurik
Status:old
Tags:
Comment:
API * better profiler modules naming
Modified paths:
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiBase.php
@@ -52,12 +52,22 @@
5353 public abstract function execute();
5454
5555 /**
56 - * Get the name of the query being executed by this instance
 56+ * Get the name of the module being executed by this instance
5757 */
5858 public function getModuleName() {
5959 return $this->mModuleName;
6060 }
6161
 62+ /**
 63+ * Get the name of the module as shown in the profiler log
 64+ */
 65+ public function getModuleProfileName($db = false) {
 66+ if ($db)
 67+ return 'API:' . $this->mModuleName . '-DB';
 68+ else
 69+ return 'API:' . $this->mModuleName;
 70+ }
 71+
6272 /**
6373 * Get main module
6474 */
@@ -394,7 +404,7 @@
395405 if ($this->mTimeIn !== 0)
396406 ApiBase :: dieDebug(__METHOD__, 'called twice without calling profileOut()');
397407 $this->mTimeIn = microtime(true);
398 - wfProfileIn($this->getModuleName());
 408+ wfProfileIn($this->getModuleProfileName());
399409 }
400410
401411 /**
@@ -408,7 +418,7 @@
409419
410420 $this->mModuleTime += microtime(true) - $this->mTimeIn;
411421 $this->mTimeIn = 0;
412 - wfProfileOut($this->getModuleName());
 422+ wfProfileOut($this->getModuleProfileName());
413423 }
414424
415425 /**
@@ -434,7 +444,7 @@
435445 if ($this->mDBTimeIn !== 0)
436446 ApiBase :: dieDebug(__METHOD__, 'called twice without calling profileDBOut()');
437447 $this->mDBTimeIn = microtime(true);
438 - wfProfileIn($this->getModuleName() . '_db');
 448+ wfProfileIn($this->getModuleProfileName(true));
439449 }
440450
441451 /**
@@ -451,7 +461,7 @@
452462
453463 $this->mDBTime += $time;
454464 $this->getMain()->mDBTime += $time;
455 - wfProfileOut($this->getModuleName() . '_db');
 465+ wfProfileOut($this->getModuleProfileName(true));
456466 }
457467
458468 /**