18/02
2017
Wallogit.com
2017 © Pedro PelĂĄez
Simplest way to profile execution time in PHP
MiniTimer is a lightweight PHP library designed to facilitate tracking and displaying the execution time of different parts of your code. It is particularly useful for debugging and performance optimization by measuring the execution time of specific code blocks., (*1)
Copy the MiniTimer.php file into your project and include it in your PHP scripts where you wish to use MiniTimer., (*2)
Here's how you can use MiniTimer in your project:, (*3)
To measure the execution time of a part of your code, surround it with the start and stop methods:, (*4)
require_once 'MiniTimer.php';
// Start the timer
MiniTimer::inst()->start('YourTaskName');
// Your code here
// Stop the timer
MiniTimer::inst()->stop('YourTaskName');
To display the results of the measurements:, (*5)
MiniTimer::inst()->display();