In this tutorial we will learn about CodeIgniter Application Profiling. When building a web application, we are very concerned about the website’s performance in terms of how long the controller has been running and how much memory is used. Not only performance, but also data insights such as POST data, database query data, session data, etc. Developing some application for debugging purposes. CodeIgniter facilitated this task by profiling an application.
Enable CodeIgniter Profiling
To allow profiling of your application, simply execute the command in any of your controller’s methods below.
The profile report can be viewed at the bottom of the page after it has been enabled.
Disable CodeIgniter Profiling
To deactivate your application profiling, simply execute the command below in any of your controller’s methods.
Enable / Disable Profiler
Profiling can be done on the basis of section. You can activate or deactivate section profiling by setting a TRUE or FALSE Boolean value. If you want to set profiling to the application, you can do it in the application/config/profiler.php file.
The following command, for example, allows profiling of queries for the entire application.
$config['queries'] = TRUE;
The key in the following table is the parameter that can be set to activate or deactivate a particular profile in the config array.
||Benchmark time and total execution time have elapsed.
||CodeIgniter Config variables
||The type and method of controller requested
||Any GET data passed in the request
||The HTTP headers for the current request
||Amount of memory consumed in bytes by the current request.
||Any POST data passed in the request
||Listing all executed database requests, including execution time.
||The URI of the current request
||Data stored in the current session
||The number of queries after which the query block is hidden by default.
The profile set in the application/config/profiler.php file can be overridden with the set_profiler_sections() function in the controllers shown below.
$sections = array(
'config' => TRUE,
'queries' => TRUE