Example #1
0
 /**
  * Render basic HTML
  *
  * @return string
  */
 protected function _toHtml()
 {
     $profilerData = Made_Cache_Model_Profiler::getProfilerData();
     if (empty($profilerData)) {
         return;
     }
     $totalTime = 0;
     $html = '<table>';
     $html .= '<thead><tr><th>Block</th><th>Time (ms)</th></tr></thead>';
     $html .= '<tbody>';
     foreach ($profilerData as $blockName => $time) {
         $html .= '<tr>' . '<td>' . $blockName . '</td>' . '<td>' . intval($time * 1000) . '</td>' . '</tr>';
         $totalTime += $time;
     }
     $html .= '<tr><th>Total time spent rendering uncached blocks:</th>' . '<th>' . intval($totalTime * 1000) . '</th></tr>';
     $html .= '</tbody>';
     $html .= '</table>';
     return $html;
 }
Example #2
0
 /**
  * Stop counting the time of rendering an uncached block
  *
  * @param Varien_Event_Observer $observer
  */
 public function profilerEnd(Varien_Event_Observer $observer)
 {
     $shouldProfile = $this->_getShouldProfile();
     if ($shouldProfile === true) {
         $blockName = $observer->getEvent()->getBlock()->getNameInLayout();
         Made_Cache_Model_Profiler::end($blockName);
     }
 }