onassar / TurtlePHP-PerformancePlugin

TurtlePHP Performance plugin which analyzes a response that is ready for flushing, and determines it's processing duration, memory usage and various vendor metrics through custom response-headers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TurtlePHP-PerformancePlugin

TurtlePHP Performance Plugin which analyzes a response that is ready for flushing, determines it's processing duration and memory usage, and returns them through custom response-headers.

Memory usage is returned in kilobytes, and represents the peak, real memory that was reached/used during the lifetime of the request.

Class is instantiable rather than abstract to allow for multiple instances on subrequests.

Sample plugin loading:

require_once APP . '/plugins/TurtlePHP-BasePlugin/Base.class.php';
require_once APP . '/plugins/TurtlePHP-PerformancePlugin/Performance.class.php';
$path = APP . '/config/plugins/performance.inc.php';
TurtlePHP\Plugin\Performance::setPerformancePath($path);
TurtlePHP\Plugin\Performance::init();

Sample Response Headers

The following headers will be sent along with the response by the framework:

TurtlePHP: ^/$
TurtlePHP-Duration: 0.0044
TurtlePHP-Memory: 768

They can easily be viewed by the document through your browser's debug/inspector tool.

About

TurtlePHP Performance plugin which analyzes a response that is ready for flushing, and determines it's processing duration, memory usage and various vendor metrics through custom response-headers.

License:MIT License


Languages

Language:PHP 100.0%