From bd6bfd4028d65b12b239f7cf87631ffeb6b16112 Mon Sep 17 00:00:00 2001 From: cyc Date: Fri, 15 Jun 2018 10:15:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=B0=E5=BD=95=E8=81=9A?= =?UTF-8?q?=E5=90=88=E7=9B=B8=E5=BA=94=E6=97=B6=E9=97=B4=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E6=89=A7=E8=A1=8C=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../third_party/train/controllers/search.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/application/third_party/train/controllers/search.php b/application/third_party/train/controllers/search.php index 81d7bfc3..342f4640 100644 --- a/application/third_party/train/controllers/search.php +++ b/application/third_party/train/controllers/search.php @@ -5,7 +5,8 @@ if (!defined('BASEPATH')) class search extends CI_Controller{ public function __construct(){ - parent::__construct(); + parent::__construct(); + $this->start_time = microtime(true); $this->load->model("BIZ_train_model");//加载模型 $this->load->model("BIZ_intel_train_model");//国际火车模型 } @@ -29,16 +30,26 @@ class search extends CI_Controller{ exit('toStation:参数错误!'); } + $api_start_time = microtime(true); //调用查询模块 $search_return = $this->Searchtrain($train_date,$fromStation,$toStation); + $api_end_time = microtime(true); //调用数据处理模块 $returnJson = $this->dataOperate($search_return,$fromStation,$toStation); //调用拼接处理模块 $trainjson = $this->createTrainJson($returnJson); + $end_time = microtime(true); + //聚合接口相应时间 + $api_responsive_time = $api_end_time - $api_start_time; + + //我们的接口相应时间 + $responsive_time = $end_time - $this->start_time; + log_message('error','TRAINSPEED 聚合相应时间:'.$api_responsive_time.'s|接口运行时间:'.$responsive_time.'s'); print_r($trainjson); + } }