Mage_Core_Block_Profiler Class Reference

Inheritance diagram for Mage_Core_Block_Profiler:

Mage_Core_Block_Abstract Varien_Object

List of all members.

Protected Member Functions

 _toHtml ()


Detailed Description

Definition at line 28 of file Profiler.php.


Member Function Documentation

_toHtml (  )  [protected]

Override this method in descendants to produce html

Returns:
string

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 30 of file Profiler.php.

00031     {
00032         if (!$this->_beforeToHtml()
00033             || !Mage::getStoreConfig('dev/debug/profiler')
00034             || !Mage::helper('core')->isDevAllowed()) {
00035             return '';
00036         }
00037 
00038         $timers = Varien_Profiler::getTimers();
00039 
00040         #$out = '<div style="position:fixed;bottom:5px;right:5px;opacity:.1;background:white" onmouseover="this.style.opacity=1" onmouseout="this.style.opacity=.1">';
00041         #$out = '<div style="opacity:.1" onmouseover="this.style.opacity=1" onmouseout="this.style.opacity=.1">';
00042         $out = "<a href=\"javascript:void(0)\" onclick=\"$('profiler_section').style.display=$('profiler_section').style.display==''?'none':''\">[profiler]</a>";
00043         $out .= '<div id="profiler_section" style="background:white; display:block">';
00044         $out .= '<pre>Memory usage: real: '.memory_get_usage(true).', emalloc: '.memory_get_usage().'</pre>';
00045         $out .= '<table border="1" cellspacing="0" cellpadding="2" style="width:auto">';
00046         $out .= '<tr><th>Code Profiler</th><th>Time</th><th>Cnt</th><th>Emalloc</th><th>RealMem</th></tr>';
00047         foreach ($timers as $name=>$timer) {
00048             $sum = Varien_Profiler::fetch($name,'sum');
00049             $count = Varien_Profiler::fetch($name,'count');
00050             $realmem = Varien_Profiler::fetch($name,'realmem');
00051             $emalloc = Varien_Profiler::fetch($name,'emalloc');
00052             if ($sum<.0010 && $count<10 && $emalloc<10000) {
00053                 continue;
00054             }
00055             $out .= '<tr>'
00056                 .'<td align="left">'.$name.'</td>'
00057                 .'<td>'.number_format($sum,4).'</td>'
00058                 .'<td align="right">'.$count.'</td>'
00059                 .'<td align="right">'.number_format($emalloc).'</td>'
00060                 .'<td align="right">'.number_format($realmem).'</td>'
00061                 .'</tr>'
00062             ;
00063         }
00064         $out .= '</table>';
00065         $out .= '<pre>';
00066         $out .= print_r(Varien_Profiler::getSqlProfiler(Mage::getSingleton('core/resource')->getConnection('core_write')), 1);
00067         $out .= '</pre>';
00068         $out .= '</div>';
00069 
00070         return $out;
00071     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:53 2009 for Magento by  doxygen 1.5.8