From 91034d333ba9861b9e8c65357990df336da22b22 Mon Sep 17 00:00:00 2001 From: zebardy Date: Tue, 19 Nov 2019 07:29:26 +0000 Subject: [PATCH] get timings for db-changed-time --- app.php | 11 +++++++++++ controllers/SystemApiController.php | 16 +++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/app.php b/app.php index f5d9d6d5..b60364e8 100644 --- a/app.php +++ b/app.php @@ -108,4 +108,15 @@ $app = new \Slim\App($appContainer); // Load routes from separate file require_once __DIR__ . '/routes.php'; +$fp = fopen('/config/data/sql.log', 'a'); +fwrite($fp, "!!!App starting run\n"); +$run_time_start = microtime(true); $app->run(); +#fwrite($fp, "!!!App - Total dependency load time in seconds: " . $dep_load_time . "\n"); +#fwrite($fp, "!!!App - Total app creation time in seconds: " . $app_creation_time . "\n"); +fwrite($fp, "!!!App - Total run time in seconds: " . round((microtime(true) - $run_time_start),6) . "\n"); +#fwrite($fp, "!!!App - Total execution time in seconds: " . round((microtime(true) - $time_start),6) . "\n"); +#fwrite($fp, "!!!APP - ini: ".print_r(ini_get_all(),TRUE)."\n"); +#fwrite($fp, "!!!APP - opcache status: ".print_r(opcache_get_status(),TRUE)."\n"); +#fwrite($fp, "!!!APP - opcache config: ".print_r(opcache_get_configuration(),TRUE)."\n"); +fclose($fp); diff --git a/controllers/SystemApiController.php b/controllers/SystemApiController.php index eabebe50..ae7c5c32 100644 --- a/controllers/SystemApiController.php +++ b/controllers/SystemApiController.php @@ -19,9 +19,19 @@ class SystemApiController extends BaseApiController public function GetDbChangedTime(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args) { - return $this->ApiResponse(array( - 'changed_time' => $this->DatabaseService->GetDbChangedTime() - )); + $fp = fopen('/config/data/sql.log', 'a'); + fwrite($fp, "---- getting db changed time ----\n"); + $time_start = microtime(true); + $response = $this->ApiResponse(array( + 'changed_time' => $this->DatabaseService->GetDbChangedTime() + )); + fwrite($fp, "----Total execution time in seconds: " . round((microtime(true) - $time_start),4) . "\n"); + fwrite($fp, "---- time obtained ----\n"); + fclose($fp); + return $response; + #return $this->ApiResponse(array( + # 'changed_time' => $this->DatabaseService->GetDbChangedTime() + #)); } public function LogMissingLocalization(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)