Example #1
0
 public static function microtime($title = null, $data = null)
 {
     if (DebugTool::$enabled) {
         if (!isset(DebugTool::$start_microtime)) {
             DebugTool::init_microtime();
         }
         $current_microtime = microtime(true);
         echo '<pre class="debug">';
         echo isset($title) ? $title . ': ' : null;
         echo number_format($current_microtime - DebugTool::$start_microtime, 3);
         echo ' (';
         $last_operation_time = $current_microtime - DebugTool::$last_microtime;
         if (isset(DebugTool::$alert_threshold) && $last_operation_time > DebugTool::$alert_threshold) {
             $calledFrom = debug_backtrace();
             echo '<span style="color:red">' . $calledFrom[0]['file'] . ' (line ' . $calledFrom[0]['line'] . ') ' . number_format($last_operation_time, 5) . '</span>';
         } elseif (DebugTool::$force_show_file) {
             $calledFrom = debug_backtrace();
             echo $calledFrom[0]['file'] . ' (line ' . $calledFrom[0]['line'] . ') ' . number_format($last_operation_time, 5);
         } else {
             echo number_format($last_operation_time, 5);
         }
         echo ')';
         if (isset($data)) {
             echo '<div style="padding-left:30px">';
             DebugTool::show($data, null, 1);
             echo '</div>';
         }
         echo '</pre>';
         DebugTool::$last_microtime = $current_microtime;
     }
 }
Example #2
0
 private static function showTestResult($test, $result, $doc)
 {
     echo '<div style="background-color:#fff;color:#444;padding:10px;margin:2px;">';
     echo '<div style="float:left;margin-right:50px;">';
     echo '<pre>';
     echo $test;
     echo '</pre>';
     echo '</div>';
     echo '<div style="float:left;margin-right:50px;">';
     echo '<pre>';
     if (is_a($result, 'DOMNode')) {
         echo htmlentities($doc->saveXML($result));
     } else {
         DebugTool::show($result);
     }
     echo '</pre>';
     echo '</div>';
     echo '<div style="clear:both;"></div>';
     echo '</div>';
 }