From 2451737d88f3ced4fa0ed3cfcb6eafac81964bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 4 Mar 2021 10:38:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HttpServer/Events/OnWorkerStart.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/HttpServer/Events/OnWorkerStart.php b/HttpServer/Events/OnWorkerStart.php index 415a7e23..296345bd 100644 --- a/HttpServer/Events/OnWorkerStart.php +++ b/HttpServer/Events/OnWorkerStart.php @@ -36,7 +36,9 @@ class OnWorkerStart extends Callback putenv('worker=' . $worker_id); putenv('state=start'); + $start = microtime(true); annotation()->read(APP_PATH . 'app', 'App'); + $this->debug(sprintf('scan app dir use time %s', microtime(true) - $start)); if ($worker_id >= $server->setting['worker_num']) { $this->onTask($server, $worker_id); @@ -56,7 +58,10 @@ class OnWorkerStart extends Callback { putenv('environmental=' . Snowflake::TASK); + + $start = microtime(true); fire(Event::SERVER_TASK_START); + $this->debug(sprintf('Event::SERVER_WORKER_START use time %s', microtime(true) - $start)); $this->set_process_name($server, $worker_id); } @@ -73,7 +78,9 @@ class OnWorkerStart extends Callback Snowflake::setWorkerId($server->worker_pid); putenv('environmental=' . Snowflake::WORKER); try { + $start = microtime(true); fire(Event::SERVER_WORKER_START, [$worker_id]); + $this->debug(sprintf('Event::SERVER_WORKER_START use time %s', microtime(true) - $start)); } catch (\Throwable $exception) { $this->addError($exception); write($exception->getMessage(), 'worker');