diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index 6af18d184606..c2c92b419727 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -374,7 +374,7 @@ protected function handleRequest(?RouteCollectionInterface $routes, Cache $cache { $routeFilter = $this->tryToRouteIt($routes); - // Run "before" filters + // Start up the filters $filters = Services::filters(); // If any filters were specified within the routes file, @@ -388,7 +388,10 @@ protected function handleRequest(?RouteCollectionInterface $routes, Cache $cache // Never run filters when running through Spark cli if (! defined('SPARKED')) { + // Run "before" filters + $this->benchmark->start('before_filters'); $possibleResponse = $filters->run($uri, 'before'); + $this->benchmark->stop('before_filters'); // If a ResponseInterface instance is returned then send it back to the client and stop if ($possibleResponse instanceof ResponseInterface) { @@ -427,8 +430,11 @@ protected function handleRequest(?RouteCollectionInterface $routes, Cache $cache // Never run filters when running through Spark cli if (! defined('SPARKED')) { $filters->setResponse($this->response); + // Run "after" filters + $this->benchmark->start('after_filters'); $response = $filters->run($uri, 'after'); + $this->benchmark->stop('after_filters'); } else { $response = $this->response;