Profiling enabled for RenderMan's wikiformat routine; [minor] made HTML from profiler more pretty
authorDan
Sun, 27 Jan 2008 23:45:53 -0500
changeset 382 2ccb55995aef
parent 381 b4751b55ee92
child 383 1030864dc319
child 387 92664d2efab8
Profiling enabled for RenderMan's wikiformat routine; [minor] made HTML from profiler more pretty
includes/functions.php
includes/render.php
--- a/includes/functions.php	Sun Jan 27 23:44:02 2008 -0500
+++ b/includes/functions.php	Sun Jan 27 23:45:53 2008 -0500
@@ -4051,35 +4051,41 @@
   
   foreach ( $profile as $i => $entry )
   {
-    $html .= "<tr><th colspan=\"2\">Event $i</th></tr>";
+    $html .= "<!-- ########################################################## -->\n<tr>\n  <th colspan=\"2\">Event $i</th>\n</tr>";
     
-    $html .= '<tr>';
-    $html .= '<td class="row2">Event:</td>';
-    $html .= '<td class="row1">' . htmlspecialchars($entry['point']) . '</td>';
-    $html .= '</tr>';
+    $html .= '<tr>' . "\n";
+    $html .= '  <td class="row2">Event:</td>' . "\n";
+    $html .= '  <td class="row1">' . htmlspecialchars($entry['point']) . '</td>' . "\n";
+    $html .= '</tr>' . "\n";
     
     $time = $entry['time'] - $time_start;
     
-    $html .= '<tr>';
-    $html .= '<td class="row2">Time since start:</td>';
-    $html .= '<td class="row1">' . $time . 's</td>';
-    $html .= '</tr>';
+    $html .= '<tr>' . "\n";
+    $html .= '  <td class="row2">Time since start:</td>' . "\n";
+    $html .= '  <td class="row1">' . $time . 's</td>' . "\n";
+    $html .= '</tr>' . "\n";
     
     $time = $entry['time'] - $time_last;
+    if ( $time < 0.0001 )
+      $time = 'Marginal';
+    else
+      $time = "{$time}s";
     
-    $html .= '<tr>';
-    $html .= '<td class="row2">Time since last event:</td>';
-    $html .= '<td class="row1">' . $time . 's</td>';
-    $html .= '</tr>';
+    $html .= '<tr>' . "\n";
+    $html .= '  <td class="row2">Time since last event:</td>' . "\n";
+    $html .= '  <td class="row1">' . $time . '</td>' . "\n";
+    $html .= '</tr>' . "\n";
     
     if ( $entry['backtrace'] )
     {
-      $html .= '<tr>';
-      $html .= '<td class="row2">Called from:</td>';
-      $html .= '<td class="row1">' . htmlspecialchars($entry['backtrace']) . '</td>';
-      $html .= '</tr>';
+      $html .= '<tr>' . "\n";
+      $html .= '  <td class="row2">Called from:</td>' . "\n";
+      $html .= '  <td class="row1">' . htmlspecialchars($entry['backtrace']) . '</td>' . "\n";
+      $html .= '</tr>' . "\n";
     }
     
+    $html .= "\n";
+    
     $time_last = $entry['time'];
   }
   $html .= '</table></div>';
--- a/includes/render.php	Sun Jan 27 23:44:02 2008 -0500
+++ b/includes/render.php	Sun Jan 27 23:45:53 2008 -0500
@@ -217,6 +217,8 @@
     global $db, $session, $paths, $template, $plugins; // Common objects
     global $lang;
     
+    profiler_log("RenderMan: starting wikitext render");
+    
     $random_id = md5( time() . mt_rand() );
     
     // Strip out <nowiki> sections and PHP code
@@ -339,6 +341,8 @@
       $result = str_replace('{PHP:'.$random_id.':'.$i.'}', '<?php'.$phpsec[1][$i].'?>', $result);
     }
     
+    profiler_log("RenderMan: finished wikitext render");
+    
     return $result;
     
   }