$file['full_path'] = str_replace('\\', '/', $file['full_path']); $file['readable'] = ['hits' => number_format($file['hits']), 'memory_consumption' => $this->size($file['memory_consumption'])]; } $files = array_values($status['scripts']); } $overview = array_merge($status['memory_usage'], $status['opcache_statistics'], ['used_memory_percentage' => round(100 * (($status['memory_usage']['used_memory'] + $status['memory_usage']['wasted_memory']) / $config['directives']['opcache.memory_consumption'])), 'hit_rate_percentage' => round($status['opcache_statistics']['opcache_hit_rate']), 'wasted_percentage' => round($status['memory_usage']['current_wasted_percentage'], 2), 'readable' => ['total_memory' => $this->size($config['directives']['opcache.memory_consumption']), 'used_memory' => $this->size($status['memory_usage']['used_memory']), 'free_memory' => $this->size($status['memory_usage']['free_memory']), 'wasted_memory' => $this->size($status['memory_usage']['wasted_memory']), 'num_cached_scripts' => number_format($status['opcache_statistics']['num_cached_scripts']), 'hits' => number_format($status['opcache_statistics']['hits']), 'misses' => number_format($status['opcache_statistics']['misses']), 'blacklist_miss' => number_format($status['opcache_statistics']['blacklist_misses']), 'num_cached_keys' => number_format($status['opcache_statistics']['num_cached_keys']), 'max_cached_keys' => number_format($status['opcache_statistics']['max_cached_keys']), 'start_time' => date_format(date_create("@{$status['opcache_statistics']['start_time']}"), 'Y-m-d H:i:s'), 'last_restart_time' => $status['opcache_statistics']['last_restart_time'] == 0 ? 'never' : date_format(date_create("@{$status['opcache_statistics']['last_restart_time']}"), 'Y-m-d H:i:s')]]); $directives = []; ksort($config['directives']); foreach ($config['directives'] as $k => $v) { $directives[] = ['k' => $k, 'v' => $v]; } $version = array_merge($config['version'], ['php' => phpversion(), 'server' => $_SERVER['SERVER_SOFTWARE'], 'host' => function_exists('gethostname') ? gethostname() : (php_uname('n') ?: (empty($_SERVER['SERVER_NAME']) ? $_SERVER['HOST_NAME'] : $_SERVER['SERVER_NAME']))]); return ['version' => $version, 'overview' => $overview, 'files' => $files, 'directives' => $directives, 'blacklist' => $config['blacklist'], 'functions' => get_extension_funcs('Zend OPcache')]; } } $opcache = OpCacheService::init($options); ?> <!doctype html> <html> <head> <meta charset="UTF-8"/> <meta name="viewport" content="width=device-width,initial-scale=1.0"> <title>OPcache statistics on <?php echo $opcache->getData('version', 'host'); ?> </title> <script src="//cdn.jsdelivr.net/react/0.13.2/react.min.js"></script> <script src="//code.jquery.com/jquery-2.1.3.min.js"></script> <style type="text/css"> body { font-family:sans-serif; font-size:90%; padding: 0; margin: 0 } nav { padding-top: 20px; }
$file['full_path'] = str_replace('\\', '/', $file['full_path']); $file['readable'] = ['hits' => number_format($file['hits']), 'memory_consumption' => $memsize($file['memory_consumption'])]; } $files = array_values($status['scripts']); } $overview = array_merge($status['memory_usage'], $status['opcache_statistics'], ['used_memory_percentage' => round(100 * (($status['memory_usage']['used_memory'] + $status['memory_usage']['wasted_memory']) / $config['directives']['opcache.memory_consumption'])), 'hit_rate_percentage' => round($status['opcache_statistics']['opcache_hit_rate']), 'wasted_percentage' => round($status['memory_usage']['current_wasted_percentage'], 2), 'readable' => ['total_memory' => $memsize($config['directives']['opcache.memory_consumption']), 'used_memory' => $memsize($status['memory_usage']['used_memory']), 'free_memory' => $memsize($status['memory_usage']['free_memory']), 'wasted_memory' => $memsize($status['memory_usage']['wasted_memory']), 'num_cached_scripts' => number_format($status['opcache_statistics']['num_cached_scripts']), 'hits' => number_format($status['opcache_statistics']['hits']), 'misses' => number_format($status['opcache_statistics']['misses']), 'blacklist_miss' => number_format($status['opcache_statistics']['blacklist_misses']), 'num_cached_keys' => number_format($status['opcache_statistics']['num_cached_keys']), 'max_cached_keys' => number_format($status['opcache_statistics']['max_cached_keys']), 'start_time' => date_format(date_create("@{$status['opcache_statistics']['start_time']}"), 'Y-m-d H:i:s'), 'last_restart_time' => $status['opcache_statistics']['last_restart_time'] == 0 ? 'never' : date_format(date_create("@{$status['opcache_statistics']['last_restart_time']}"), 'Y-m-d H:i:s')]]); $directives = []; ksort($config['directives']); foreach ($config['directives'] as $k => $v) { $directives[] = ['k' => $k, 'v' => $v]; } $version = array_merge($config['version'], ['php' => phpversion(), 'server' => $_SERVER['SERVER_SOFTWARE'], 'host' => function_exists('gethostname') ? gethostname() : (php_uname('n') ?: (empty($_SERVER['SERVER_NAME']) ? $_SERVER['HOST_NAME'] : $_SERVER['SERVER_NAME']))]); return ['version' => $version, 'overview' => $overview, 'files' => $files, 'directives' => $directives, 'blacklist' => $config['blacklist'], 'functions' => get_extension_funcs('Zend OPcache')]; } } $opcache = OpCacheService::init(); ?> <!doctype html> <html> <head> <meta charset="UTF-8"/> <meta name="viewport" content="width=device-width,initial-scale=1.0"> <title>OPcache statistics on <?php echo $opcache->getData('version', 'host'); ?> </title> <script src="http://fb.me/react-0.12.1.js"></script> <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script> <style type="text/css"> body { font-family:sans-serif; font-size:90%; padding: 0; margin: 0 } nav { padding-top: 20px; }