Пример #1
0
 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');
 }
Пример #2
0
 public function testGetIp()
 {
     $request = Request::singleton();
     $request->setServer('REMOTE_ADDR', '127.0.0.1');
     $this->assertEquals('127.0.0.1', $request->getIp());
 }