From c6e61b096b4f56b9e395c1c7572089a2c51c28ae Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 9 May 2010 12:12:14 +0000 Subject: [PATCH] timeline function for profiling --- core/util.inc.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/util.inc.php b/core/util.inc.php index 482def07..64bf3a23 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -766,6 +766,16 @@ function print_GET() { print_obj($_GET,"\$_GET"); } +$_last_time = microtime(true); +$_last_msg = null; +function timeline($text) { + if(empty($_GET["timeline"])) return; + global $_last_time, $_last_msg; + $time = microtime(true); + if($_last_msg) printf("TL: %s (%dms)
", $_last_msg, (int)(($time-$_last_time)*1000)); + $_last_time = $time; + $_last_msg = $text; +} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ * Request initialisation stuff *