2, 'used_memory_percentage_high_threshold' => 80, 'used_memory_percentage_mid_threshold' => 60, 'allow_invalidate' => true ); $validPages = array('overview', 'files', 'reset', 'invalidate'); $page = (empty($_GET['page']) || !in_array($_GET['page'], $validPages) ? 'overview' : strtolower($_GET['page']) ); if ($page == 'reset') { opcache_reset(); header('Location: ?page=overview'); exit; } if ($page == 'invalidate') { $file = (isset($_GET['file']) ? trim($_GET['file']) : null); if (!$settings['allow_invalidate'] || !function_exists('opcache_invalidate') || empty($file)) { header('Location: ?page=files&error=1'); exit; } $success = (int)opcache_invalidate(urldecode($file), true); header("Location: ?page=files&success={$success}"); exit; } $opcache_config = opcache_get_configuration(); $opcache_status = opcache_get_status(); $opcache_funcs = get_extension_funcs('Zend OPcache'); if (!empty($opcache_status['scripts'])) { uasort($opcache_status['scripts'], function($a, $b) { return $a['hits'] < $b['hits']; }); } function memsize($size, $precision = 3, $space = false) { $i = 0; $val = array(' bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); while (($size / 1024) > 1) { $size /= 1024; ++$i; } return sprintf("%.{$precision}f%s%s", $size, (($space && $i) ? ' ' : ''), $val[$i]); } function rc($at = null) { static $i = 0; if ($at !== null) { $i = $at; } else { echo (++$i % 2 ? 'even' : 'odd'); } } $data = array_merge( $opcache_status['memory_usage'], $opcache_status['opcache_statistics'], array( 'total_memory_size' => memsize($opcache_config['directives']['opcache.memory_consumption']), 'used_memory_percentage' => round(100 * ( ($opcache_status['memory_usage']['used_memory'] + $opcache_status['memory_usage']['wasted_memory']) / $opcache_config['directives']['opcache.memory_consumption'])), 'hit_rate_percentage' => round($opcache_status['opcache_statistics']['opcache_hit_rate']), 'wasted_percentage' => round($opcache_status['memory_usage']['current_wasted_percentage'], 2), 'used_memory_size' => memsize($opcache_status['memory_usage']['used_memory']), 'free_memory_size' => memsize($opcache_status['memory_usage']['free_memory']), 'wasted_memory_size' => memsize($opcache_status['memory_usage']['wasted_memory']), 'files_cached' => number_format($opcache_status['opcache_statistics']['num_cached_scripts']), 'hits_size' => number_format($opcache_status['opcache_statistics']['hits']), 'miss_size' => number_format($opcache_status['opcache_statistics']['misses']), 'blacklist_miss_size' => number_format($opcache_status['opcache_statistics']['blacklist_misses']), 'num_cached_keys_size' => number_format($opcache_status['opcache_statistics']['num_cached_keys']), 'max_cached_keys_size' => number_format($opcache_status['opcache_statistics']['max_cached_keys']), ) ); $threshold = ''; if ($data['used_memory_percentage'] >= $settings['used_memory_percentage_high_threshold']) { $threshold = ' high'; } elseif ($data['used_memory_percentage'] >= $settings['used_memory_percentage_mid_threshold']) { $threshold = ' mid'; } if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ) { echo json_encode($data); exit; } $host = (function_exists('gethostname') ? gethostname() : (php_uname('n') ?: (empty($_SERVER['SERVER_NAME']) ? $_SERVER['HOST_NAME'] : $_SERVER['SERVER_NAME'] ) ) ); ?>
%
memory usage
%
hit rate
total memory:
used memory:
free memory:
wasted memory: (%)
number of cached files:
number of hits:
number of misses:
blacklist misses:
number of cached keys:
max cached keys:
Script | Details |
---|---|
'; echo join(DIRECTORY_SEPARATOR, array_slice($parts, $settings['compress_path_threshold'])); if (count($parts) > $settings['compress_path_threshold']) { echo DIRECTORY_SEPARATOR; } echo "{$base}"; } else { echo htmlentities($s['full_path'], ENT_COMPAT, 'UTF-8'); } ?>Force file invalidation |
hits: ,
memory: |