Example #1
0
 /**
  * Printing function.
  */
 public function printData(\PhpSimpleProfiler\Profiler $profiler)
 {
     $statistics = $profiler->getStat();
     $strHead = "<table><thead><tr>";
     $strHead .= "<th>Time</th>";
     $strHead .= "<th>Memory Usage</th>";
     $strHead .= "<th>Execution Time</th>";
     $strHead .= "<th>Info</th>";
     $strHead .= "</tr></thead>";
     $strBody = "<tbody>";
     foreach ($statistics as $satistic) {
         $strBody .= "<tr>";
         $strBody .= "<td>" . $satistic['time'] . "</td>";
         $strBody .= "<td>" . $this->byteFormat($satistic['memory_usage'], 'MB') . "</td>";
         $strBody .= "<td>" . $satistic['execution_time'] . "</td>";
         $strBody .= "<td>" . $satistic['info'] . "</td>";
         $strBody .= "</tr>";
     }
     $strBody .= "</tbody></table>";
     $strFooter = '';
     $strFooter .= "Peak of memory usage: " . $this->byteFormat($profiler->getPeakMemoryUsage(), 'MB');
     $strFooter .= "<p>";
     $strFooter .= "CPU elaboration time: " . $profiler->getTotalTime();
     return "<div id='PHPSimpleProfiler'>" . $strHead . $strBody . $strFooter . "</div>";
 }
 /**
  * Printing function.
  */
 public function printData(\PhpSimpleProfiler\Profiler $profiler)
 {
     $statistics = $profiler->getStat();
     $strToLog = "\n\n";
     foreach ($statistics as $satistic) {
         $strToLog .= "Time: " . $satistic['time'] . " | Memory Usage: " . $this->byteFormat($satistic['memory_usage'], 'MB') . " | execution_time: " . $satistic['execution_time'] . " | Info: " . $satistic['info'];
         $strToLog .= "\n";
     }
     $strToLog .= "\n";
     $strToLog .= "Peak of memory usage: " . $this->byteFormat($profiler->getPeakMemoryUsage(), 'MB');
     $strToLog .= "\n\n";
     $strToLog .= "CPU elaboration time: " . $profiler->getTotalTime();
     $strToLog .= "\n\n";
     return $strToLog;
 }