I would name a new library for the production server. When I debug, I like to use the * auto_prepend_file * and * auto_append_file * directives in php.ini. You can easily do as suggested above using this method and get a very accurate time for each page load.
If you are concerned only with slow download pages, measured in seconds, here is a quick and dirty solution that subtracts the server request time from the approximate end time in the file with the addition automatically. Then you can save the result in db or flat file.
e.g. in php.in
auto_append_file = [location]/my_timer.php
my_timer.php
define('TRIGGER_TIME_LOG','3'); // Minimum number of timer seconds to log page load $time = time() - $_SERVER['REQUEST_TIME']; // Page load time if($time >= TRIGGER_TIME_LOG) { /* * DO LOGGING TO DB OR FLAT FILE HERE */ }
Drperdix
source share