public function dispatch(Request $request = null) { Timer::start('run'); if (null === $request) { $this->request = Request::singleton(); } else { $this->request = $request; } $this->mypid = getmypid(); $mypid = $this->mypid; $this->bootstrap(); $app = $this->request->getController(); $action = $this->request->getAction(); Log::info("Begin to execute. [app:{$app} action:{$action} pid:{$mypid}]"); parent::dispatch($this->request); Timer::end('run'); $time = Timer::cal('run'); Log::info('Memory usage: ' . round(memory_get_usage() / 1024 / 1024, 2) . 'MB (peak: ' . round(memory_get_peak_usage() / 1024 / 1024, 2) . 'MB), time: ' . $time . 'us'); }