Skip to content

Instantly share code, notes, and snippets.

@solepixel
Created January 18, 2017 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save solepixel/9d8ad69c7b962e673e43a78b99e94496 to your computer and use it in GitHub Desktop.
Save solepixel/9d8ad69c7b962e673e43a78b99e94496 to your computer and use it in GitHub Desktop.
<?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