Created
May 17, 2009 08:51
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class sfWebDebugPanelAdvancedMemory extends sfWebDebugPanelMemory | |
{ | |
public function getTitle() | |
{ | |
return parent::getTitle(); | |
} | |
public function getPanelTitle() | |
{ | |
return 'Memory usage'; | |
} | |
public function getPanelContent() | |
{ | |
$html = ''; | |
if (function_exists('memory_get_usage')) | |
{ | |
$html .= '<h2>Memory Usage</h2><p>' . self::formatMemoryUsage(memory_get_usage()) . '</p>'; | |
$html .= '<h2>Memory Peak Usage</h2><p>' . self::formatMemoryUsage(memory_get_peak_usage()) . '</p>'; | |
$html .= '<h2>PHP Memory Limit</h2><p>' . ini_get('memory_limit') . '</p>'; | |
} | |
return $html; | |
} | |
static public function formatMemoryUsage($memoryUsage) | |
{ | |
return sprintf('%.1f', ($memoryUsage / 1024)) . 'KB'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment