/** * 在yaf路由分发之后响应正文之前,保存XHProf的性能统计数据 * * @access public * @param Request_Abstract $request * @param Response_Abstract $response * @return void */ public function dispatchLoopShutdown(Request_Abstract $request, Response_Abstract $response) { if (isset(Application::app()->getConfig()->application->xhprof)) { $xhprof_config = Application::app()->getConfig()->application->xhprof->toArray(); if (extension_loaded('xhprof') && $xhprof_config && isset($xhprof_config['open']) && $xhprof_config['open']) { $namespace = $xhprof_config['namespace'] ? $xhprof_config['namespace'] : 'DefaultNameSpace'; $xhprof_data = xhprof_disable(); $xhprof_runs = new XHProfFiles(); $run_id = ucfirst($request->module) . ucfirst($request->controller) . ucfirst($request->action) . '-' . str_replace('.', '', (string) microtime(true)); $xhprof_runs->save_run($xhprof_data, $namespace, $run_id); } } }
/** * 在yaf路由分发之后响应正文之前,保存XHProf的性能统计数据 * * @access public * @param Request_Abstract $request * @param Response_Abstract $response * @return void */ public function dispatchLoopShutdown(Request_Abstract $request, Response_Abstract $response) { if (isset(Application::app()->getConfig()->application->xhprof)) { $xhprof_config = Application::app()->getConfig()->application->xhprof->toArray(); if (extension_loaded('xhprof') && $xhprof_config && isset($xhprof_config['open']) && $xhprof_config['open']) { $namespace = $xhprof_config['namespace'] ? $xhprof_config['namespace'] : ''; $xhprof_data = xhprof_disable(); $xhprof_runs = new XHProfFiles(); $run_id = ucfirst($request->module) . ucfirst($request->controller) . ucfirst($request->action) . '-' . str_replace('.', '', (string) microtime(true)); $xhprof_runs->save_run($xhprof_data, $namespace, $run_id); echo "<a href='http://test.lc.com/xhprof092/xhprof_html/index.php?run={$run_id}.{$namespace}&source=xhprof'>click here</a>"; } } }