Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fivestar/112967 to your computer and use it in GitHub Desktop.
Save fivestar/112967 to your computer and use it in GitHub Desktop.
<?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