Skip to content

Commit 32d0586

Browse files
Mofasachriskacerguis
authored andcommitted
Enhance: log execute time (chriskacerguis#965)
1 parent d51e373 commit 32d0586

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

application/libraries/REST_Controller.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,12 @@ public function __construct($config = 'rest')
405405
// when output is displayed for not damaging data accidentally
406406
$this->output->parse_exec_vars = FALSE;
407407

408-
// Start the timer for how long the request takes
409-
$this->_start_rtime = microtime(TRUE);
408+
// Log the loading time to the log table
409+
if ($this->config->item('rest_enable_logging') === TRUE)
410+
{
411+
// Start the timer for how long the request takes
412+
$this->_start_rtime = microtime(TRUE);
413+
}
410414

411415
// Load the rest.php configuration file
412416
$this->get_local_config($config);
@@ -626,12 +630,12 @@ private function get_local_config($config_file)
626630
*/
627631
public function __destruct()
628632
{
629-
// Get the current timestamp
630-
$this->_end_rtime = microtime(TRUE);
631-
632633
// Log the loading time to the log table
633634
if ($this->config->item('rest_enable_logging') === TRUE)
634635
{
636+
// Get the current timestamp
637+
$this->_end_rtime = microtime(TRUE);
638+
635639
$this->_log_access_time();
636640
}
637641
}

0 commit comments

Comments
 (0)