function column_default($item, $column_name) { switch ($column_name) { case 'last_used_timestamp': case 'timestamp': return isset($item[$column_name]) ? date(__('j M, Y @ G:i:s', 'opcache'), $item[$column_name]) : __('Not Set', 'opcache'); case 'memory_consumption': return OPcache_dashboard::size($item[$column_name]); default: return $item[$column_name]; } }
function column_value($item) { switch ($item['name']) { case 'start_time': case 'last_restart_time': return $item['value'] ? date(__('j M, Y @ G:i:s', 'opcache'), $item['value']) : __('never'); case 'used_memory': case 'free_memory': case 'wasted_memory': return OPcache_dashboard::size($item['value']); case 'current_wasted_percentage': case 'blacklist_miss_ratio': case 'opcache_hit_rate': return OPcache_dashboard::number_format($item['value']) . '%'; default: return $item['value']; } }
public function test_init() { $this->assertInstanceOf('OPcache_dashboard', OPcache_dashboard::init()); }
static function size($size) { $si_units = array('', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'); $i = 0; while ($size >= 1024 && $i < count($si_units)) { $size = round($size / 1024, 2); $i++; } return OPcache_dashboard::number_format($size) . $si_units[$i] . 'B'; }
function column_value($item) { switch ($item['name']) { case 'directives.opcache.memory_consumption': return OPcache_dashboard::size($item['value']); case 'directives.opcache.interned_strings_buffer': return OPcache_dashboard::size($item['value'] * 1024 * 1024); case 'directives.opcache.max_wasted_percentage': return OPcache_dashboard::number_format($item['value']) . '%'; default: return $item['value']; } }