public function getSummary() { if (Yii::app()->getComponent('xhprof', false) === null) { return null; } XHProf::getInstance()->setHtmlUrlPath(Yii::app()->xhprof->getReportBaseUrl()); $urls = array(); $data = $this->getData(); if ($data['enabled']) { $urls['report'] = XHProf::getInstance()->getReportUrl($data['runId'], $data['ns']); $urls['callgraph'] = XHProf::getInstance()->getCallgraphUrl($data['runId'], $data['ns']); } return $this->render(__DIR__ . '/views/panel.php', array('enabled' => $data['enabled'], 'urls' => $urls)); }
/** * Get report details for current profiling process. Info consists of: * - unique run identifier (runId) * - namespace for run (ns, current application ID by default) * - requested URL (url) * - time of request (time) * @return array key-valued list */ public function getReportInfo() { if (!$this->isActive()) { return array('enabled' => false, 'runId' => null, 'ns' => null, 'url' => null, 'time' => null); } if ($this->reportInfo === null) { $request = Yii::app()->getRequest(); $this->reportInfo = array('enabled' => true, 'runId' => XHProf::getInstance()->getRunId(), 'ns' => XHProf::getInstance()->getRunNamespace(), 'url' => $request->getHostInfo() . $request->getUrl(), 'time' => microtime(true)); } return $this->reportInfo; }