diff options
author | Alexander Kampmann <programmer@nurfuerspam.de> | 2012-03-15 12:55:49 +0100 |
---|---|---|
committer | Alexander Kampmann <programmer@nurfuerspam.de> | 2012-03-15 12:55:49 +0100 |
commit | 899701c3d36a6391fa0a5991ee88f3394c11762b (patch) | |
tree | 1574bc7c651531db4b26e8cf79bd07f40c28cebf /util | |
parent | 9796e99fa8378758c4fe0f655b7c192f8fc1690f (diff) | |
download | volse-hubzilla-899701c3d36a6391fa0a5991ee88f3394c11762b.tar.gz volse-hubzilla-899701c3d36a6391fa0a5991ee88f3394c11762b.tar.bz2 volse-hubzilla-899701c3d36a6391fa0a5991ee88f3394c11762b.zip |
integrated profiler
Diffstat (limited to 'util')
-rwxr-xr-x | util/profiler.php | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/util/profiler.php b/util/profiler.php index 3a3de5373..fe33fe429 100755 --- a/util/profiler.php +++ b/util/profiler.php @@ -1,24 +1,12 @@ <?php function microtime_float()
{
- list($usec, $sec) = explode(" ", microtime());
- return ((float)$usec + (float)$sec);
+ return microtime(true);
}
function tick_event() { - static $time = NULL; - - if(NULL===$time) { - //initialise time with now - $time=microtime_float(); - - q("INSERT INTO `profiling` (`function`, `file`, `line`, `class`, `time`) VALUES ('initialization', 'index.php', '-1', NULL, '%f'); ",
- floatval($time-$_SERVER['REQUEST_TIME'])); - } - - $elapsed=microtime_float()-$time; - - $db_info=array_shift(debug_backtrace()); + $db_info=debug_backtrace(); + $db_info=$db_info[1]; $function=$db_info['function']; $file=$db_info['file']; $line=$db_info['line']; @@ -26,11 +14,8 @@ function tick_event() { //save results q("INSERT INTO `profiling` (`function`, `file`, `line`, `class`, `time`) VALUES ('%s', '%s', '%d', '%s', '%f'); ", - dbesc($function), dbesc($file), intval($line), dbesc($class), floatval($time)); - - //set time to now - $time=microtime_float(); + dbesc($function), dbesc($file), intval($line), dbesc($class), microtime_float()*1000); } -declare(ticks=1);
-register_tick_function('tick_event');
\ No newline at end of file +register_tick_function('tick_event');
+declare(ticks=50);
\ No newline at end of file |