aboutsummaryrefslogtreecommitdiffstats
path: root/util/profiler.php
diff options
context:
space:
mode:
Diffstat (limited to 'util/profiler.php')
-rwxr-xr-xutil/profiler.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/util/profiler.php b/util/profiler.php
new file mode 100755
index 000000000..fe33fe429
--- /dev/null
+++ b/util/profiler.php
@@ -0,0 +1,21 @@
+<?php
+function microtime_float()
+{
+ return microtime(true);
+}
+
+function tick_event() {
+ $db_info=debug_backtrace();
+ $db_info=$db_info[1];
+ $function=$db_info['function'];
+ $file=$db_info['file'];
+ $line=$db_info['line'];
+ $class=$db_info['class'];
+
+ //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), microtime_float()*1000);
+}
+
+register_tick_function('tick_event');
+declare(ticks=50); \ No newline at end of file