Add a step function to the profiler to easily switch to another event of the same...
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 10 Nov 2007 23:36:19 +0000 (00:36 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 10 Nov 2007 23:36:19 +0000 (00:36 +0100)
Before:                                     After:
PlProfiler::start("Machin", "truc");        PlProfiler::start("Machin", "truc");
do_truc();                                  do_truc();
PlProfiler::stop("Machin");
PlProfiler::start("Machin", "bidule");      PlProfiler::step("Machin", "bidule");
do_bidule();                                do_bidule();
PlProfiler::stop("Machin");                 PlProfiler::stop("Machin);

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/plprofiler.php

index 3b66426..7b6106b 100644 (file)
@@ -34,6 +34,12 @@ class PlProfiler
         return true;
     }
 
+    static public function step($name, $info = "action")
+    {
+        PlProfiler::stop($name);
+        PlProfiler::start($name, $info);
+    }
+
     static public function stop($name)
     {
         global $globals;