Created
January 18, 2017 07:05
-
-
Save solepixel/9d8ad69c7b962e673e43a78b99e94496 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $_started_time; | |
if( ! function_exists( '_perf_debug' ) ){ | |
function _perf_debug( $file, $line, $comment = '' ){ | |
global $_started_time; | |
$file = str_replace( $_SERVER['DOCUMENT_ROOT'], '', $file ); | |
$time = microtime( true ); | |
if( ! $_started_time ) | |
$_started_time = $time; | |
$diff = $time - $_started_time; | |
if( $comment ) | |
$comment = $comment . ': '; | |
$line = '[' . $time . '] ' . $comment . $file . ' #' . $line . ' (' . $diff . ')'; | |
echo $line . '<br />' . "\r\n"; | |
error_log( $line ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment