/** * @override \local_telemetry\request_state */ public function get_records() { $record = new stdClass(); $filecachefileinfo = wincache_fcache_fileinfo(true); if ($filecachefileinfo) { $record->f_f_uptime = $filecachefileinfo['total_cache_uptime']; $record->f_f_items = $filecachefileinfo['total_file_count']; $record->f_f_hits = $filecachefileinfo['total_hit_count']; $record->f_f_misses = $filecachefileinfo['total_miss_count']; } $filecachememinfo = wincache_fcache_meminfo(); if ($filecachememinfo) { $record->f_m_total = $filecachememinfo['memory_total']; $record->f_m_free = $filecachememinfo['memory_free']; $record->f_m_used_blocks = $filecachememinfo['num_used_blks']; $record->f_m_free_blocks = $filecachememinfo['num_free_blks']; $record->f_m_overhead = $filecachememinfo['memory_overhead']; } $opcodecachefileinfo = wincache_ocache_fileinfo(true); if ($opcodecachefileinfo) { $record->o_f_uptime = $opcodecachefileinfo['total_cache_uptime']; $record->o_f_items = $opcodecachefileinfo['total_file_count']; $record->o_f_hits = $opcodecachefileinfo['total_hit_count']; $record->o_f_misses = $opcodecachefileinfo['total_miss_count']; $record->o_f_islocal = $opcodecachefileinfo['is_local_cache']; } $opcodecachememinfo = wincache_ocache_meminfo(); if ($opcodecachememinfo) { $record->o_m_total = $opcodecachememinfo['memory_total']; $record->o_m_free = $opcodecachememinfo['memory_free']; $record->o_m_used_blocks = $opcodecachememinfo['num_used_blks']; $record->o_m_free_blocks = $opcodecachememinfo['num_free_blks']; $record->o_m_overhead = $opcodecachememinfo['memory_overhead']; } $resolvedpathcachefileinfo = wincache_rplist_fileinfo(true); if ($resolvedpathcachefileinfo) { $record->rp_f_files = $resolvedpathcachefileinfo['total_file_count']; } $resolvedpathcachememinfo = wincache_rplist_meminfo(); if ($resolvedpathcachememinfo) { $record->rp_m_total = $resolvedpathcachememinfo['memory_total']; $record->rp_m_free = $resolvedpathcachememinfo['memory_free']; $record->rp_m_used_blocks = $resolvedpathcachememinfo['num_used_blks']; $record->rp_m_free_blocks = $resolvedpathcachememinfo['num_free_blks']; $record->rp_m_overhead = $resolvedpathcachememinfo['memory_overhead']; } $sessioncacheinfo = wincache_scache_info(true); if ($sessioncacheinfo) { $record->s_i_uptime = $sessioncacheinfo['total_cache_uptime']; $record->s_i_items = $sessioncacheinfo['total_item_count']; $record->s_i_islocal = $sessioncacheinfo['is_local_cache']; $record->s_i_hits = $sessioncacheinfo['total_hit_count']; $record->s_i_misses = $sessioncacheinfo['total_miss_count']; } $sessioncachememinfo = wincache_scache_meminfo(); if ($sessioncachememinfo) { $record->s_m_total = $sessioncachememinfo['memory_total']; $record->s_m_free = $sessioncachememinfo['memory_free']; $record->s_m_used_blocks = $sessioncachememinfo['num_used_blks']; $record->s_m_free_blocks = $sessioncachememinfo['num_free_blks']; $record->s_m_overhead = $sessioncachememinfo['memory_overhead']; } $usercacheinfo = wincache_ucache_info(true); if ($usercacheinfo) { $record->u_i_uptime = $usercacheinfo['total_cache_uptime']; $record->u_i_items = $usercacheinfo['total_item_count']; $record->u_i_islocal = $usercacheinfo['is_local_cache']; $record->u_i_hits = $usercacheinfo['total_hit_count']; $record->u_i_misses = $usercacheinfo['total_miss_count']; } $usercachememinfo = wincache_ucache_meminfo(); if ($usercachememinfo) { $record->u_m_total = $usercachememinfo['memory_total']; $record->u_m_free = $usercachememinfo['memory_free']; $record->u_m_used_blocks = $usercachememinfo['num_used_blks']; $record->u_m_free_blocks = $usercachememinfo['num_free_blks']; $record->u_m_overhead = $usercachememinfo['memory_overhead']; } return array($record); }
function __construct() { $wincache_enabled = ini_get('wincache.ocenabled'); $memory = wincache_ocache_meminfo(); parent::__construct(!($wincache_enabled == "0" || strtolower($wincache_enabled) == "off"), -1, -1, true, $memory["memory_total"], $memory["memory_total"] - $memory["memory_free"]); }
function init_cache_info($cache_data = SUMMARY_DATA) { global $ocache_mem_info, $ocache_file_info, $ocache_summary_info, $fcache_mem_info, $fcache_file_info, $fcache_summary_info, $rpcache_mem_info, $rpcache_file_info, $ucache_mem_info, $ucache_info, $scache_mem_info, $scache_info, $user_cache_available, $session_cache_available; if ($cache_data == SUMMARY_DATA || $cache_data == OCACHE_DATA) { $ocache_mem_info = wincache_ocache_meminfo(); $ocache_file_info = wincache_ocache_fileinfo(); $ocache_summary_info = get_ocache_summary($ocache_file_info['file_entries']); } if ($cache_data == SUMMARY_DATA || $cache_data == FCACHE_DATA) { $fcache_mem_info = wincache_fcache_meminfo(); $fcache_file_info = wincache_fcache_fileinfo(); $fcache_summary_info = get_fcache_summary($fcache_file_info['file_entries']); } if ($cache_data == SUMMARY_DATA || $cache_data == RCACHE_DATA) { $rpcache_mem_info = wincache_rplist_meminfo(); $rpcache_file_info = wincache_rplist_fileinfo(); } if ($user_cache_available && ($cache_data == SUMMARY_DATA || $cache_data == UCACHE_DATA)) { $ucache_mem_info = wincache_ucache_meminfo(); $ucache_info = wincache_ucache_info(); } if ($session_cache_available && ($cache_data == SUMMARY_DATA || $cache_data == SCACHE_DATA)) { $scache_mem_info = wincache_scache_meminfo(); $scache_info = wincache_scache_info(); } }
$opcode_stats['memory_total'] += $info['size']; } $opcode_stats['memory_used'] /= $opcode_stats['memory_total']; $opcode_stats['memory_avail'] /= $opcode_stats['memory_total']; $opcode_stats['hit_hit'] /= $opcode_stats['hit_total']; $opcode_stats['hit_miss'] /= $opcode_stats['hit_total']; } } elseif (function_exists('wincache_ocache_fileinfo') && ini_get('wincache.ocenabled') == '1') { $opcode_cache = 'WinCache'; $stat_flag = 'wincache.ocenabled'; $opcode_stats = array('memory_used' => 0, 'memory_avail' => 0, 'memory_total' => 0, 'hit_hit' => 0, 'hit_miss' => 0, 'hit_total' => 0, 'type' => 'wincache'); $info = wincache_ocache_fileinfo(); $opcode_stats['hit_hit'] = $info['total_hit_count']; $opcode_stats['hit_miss'] = $info['total_miss_count']; $opcode_stats['hit_total'] = $info['total_hit_count'] + $info['total_miss_count']; $memory = wincache_ocache_meminfo(); $opcode_stats['memory_avail'] = $memory['memory_free']; $opcode_stats['memory_total'] = $memory['memory_total']; $opcode_stats['memory_used'] = $memory['memory_total'] - $memory['memory_free']; $opcode_stats['memory_used'] /= $opcode_stats['memory_total']; $opcode_stats['memory_avail'] /= $opcode_stats['memory_total']; $opcode_stats['hit_hit'] /= $opcode_stats['hit_total']; $opcode_stats['hit_miss'] /= $opcode_stats['hit_total']; } // Make results easier to read $opcode_stats['memory_used'] = round($opcode_stats['memory_used'], 2); $opcode_stats['memory_avail'] = round($opcode_stats['memory_avail'], 2); $opcode_stats['hit_hit'] = round($opcode_stats['hit_hit'], 2); $opcode_stats['hit_miss'] = round($opcode_stats['hit_miss'], 2); if ($stat_flag) { $opcode_stats['warning_check'] = (bool) ini_get($stat_flag);
public function getOpcodeCacheStatus() { $opcode_stats = array('opcode_cache' => null, 'stat_flag' => null, 'warning_check' => false, 'warning_fresh' => false, 'warning_ratio' => false, 'warning_starve' => false, 'warning_low' => false, 'warning_xcache_blocked' => false); if (function_exists('apc_sma_info') && ini_get('apc.enabled')) { if ($_REQUEST['apc_clear']) { check_ticket('admin-inc-performance'); apc_clear_cache(); apc_clear_cache('user'); apc_clear_cache('opcode'); } $sma = apc_sma_info(); $mem_total = $sma['num_seg'] * $sma['seg_size']; $cache = apc_cache_info(null, true); $hit_total = $cache['num_hits'] + $cache['num_misses']; if (!$hit_total) { // cheat for chart after cache clear $hit_total = 1; $cache['num_misses'] = 1; } $opcode_stats = array('opcode_cache' => 'APC', 'stat_flag' => 'apc.stat', 'memory_used' => ($mem_total - $sma['avail_mem']) / $mem_total, 'memory_avail' => $sma['avail_mem'] / $mem_total, 'memory_total' => $mem_total, 'hit_hit' => $cache['num_hits'] / $hit_total, 'hit_miss' => $cache['num_misses'] / $hit_total, 'hit_total' => $hit_total, 'type' => 'apc'); } elseif (function_exists('xcache_info') && (ini_get('xcache.cacher') == '1' || ini_get('xcache.cacher') == 'On')) { if (ini_get('xcache.admin.enable_auth') == '1' || ini_get('xcache.admin.enable_auth') == 'On') { $opcode_stats['warning_xcache_blocked'] = true; } else { $opcode_stats = array('stat_flag' => 'xcache.stat', 'memory_used' => 0, 'memory_avail' => 0, 'memory_total' => 0, 'hit_hit' => 0, 'hit_miss' => 0, 'hit_total' => 0, 'type' => 'xcache'); foreach (range(0, xcache_count(XC_TYPE_PHP) - 1) as $index) { $info = xcache_info(XC_TYPE_PHP, $index); $opcode_stats['hit_hit'] += $info['hits']; $opcode_stats['hit_miss'] += $info['misses']; $opcode_stats['hit_total'] += $info['hits'] + $info['misses']; $opcode_stats['memory_used'] += $info['size'] - $info['avail']; $opcode_stats['memory_avail'] += $info['avail']; $opcode_stats['memory_total'] += $info['size']; } $opcode_stats['memory_used'] /= $opcode_stats['memory_total']; $opcode_stats['memory_avail'] /= $opcode_stats['memory_total']; $opcode_stats['hit_hit'] /= $opcode_stats['hit_total']; $opcode_stats['hit_miss'] /= $opcode_stats['hit_total']; } $opcode_stats['opcode_cache'] = 'XCache'; } elseif (function_exists('wincache_ocache_fileinfo') && ini_get('wincache.ocenabled') == '1') { $opcode_stats = array('opcode_cache' => 'WinCache', 'stat_flag' => 'wincache.ocenabled', 'memory_used' => 0, 'memory_avail' => 0, 'memory_total' => 0, 'hit_hit' => 0, 'hit_miss' => 0, 'hit_total' => 0, 'type' => 'wincache'); $info = wincache_ocache_fileinfo(); $opcode_stats['hit_hit'] = $info['total_hit_count']; $opcode_stats['hit_miss'] = $info['total_miss_count']; $opcode_stats['hit_total'] = $info['total_hit_count'] + $info['total_miss_count']; $memory = wincache_ocache_meminfo(); $opcode_stats['memory_avail'] = $memory['memory_free']; $opcode_stats['memory_total'] = $memory['memory_total']; $opcode_stats['memory_used'] = $memory['memory_total'] - $memory['memory_free']; $opcode_stats['memory_used'] /= $opcode_stats['memory_total']; $opcode_stats['memory_avail'] /= $opcode_stats['memory_total']; $opcode_stats['hit_hit'] /= $opcode_stats['hit_total']; $opcode_stats['hit_miss'] /= $opcode_stats['hit_total']; } elseif (function_exists('opcache_get_status') && ini_get('opcache.enable') == '1') { $opcode_stats['opcode_cache'] = 'OpCache'; $status = opcache_get_status(); $opcode_stats['hit_hit'] = $status['opcache_statistics']['hits']; $opcode_stats['hit_miss'] = $status['opcache_statistics']['misses']; $opcode_stats['hit_total'] = $status['opcache_statistics']['hits'] + $status['opcache_statistics']['misses']; $opcode_stats['memory_avail'] = $status['memory_usage']['free_memory']; $opcode_stats['memory_used'] = $status['memory_usage']['used_memory']; $opcode_stats['memory_total'] = $status['memory_usage']['used_memory'] + $status['memory_usage']['free_memory']; $opcode_stats['memory_used'] /= $opcode_stats['memory_total']; $opcode_stats['memory_avail'] /= $opcode_stats['memory_total']; $opcode_stats['hit_hit'] /= $opcode_stats['hit_total']; $opcode_stats['hit_miss'] /= $opcode_stats['hit_total']; } // Make results easier to read $opcode_stats['memory_used'] = round($opcode_stats['memory_used'], 2); $opcode_stats['memory_avail'] = round($opcode_stats['memory_avail'], 2); $opcode_stats['hit_hit'] = round($opcode_stats['hit_hit'], 2); $opcode_stats['hit_miss'] = round($opcode_stats['hit_miss'], 2); if (isset($opcode_stats['hit_total'])) { $opcode_stats = array_merge($opcode_stats, array('warning_fresh' => $opcode_stats['hit_total'] < 10000, 'warning_ratio' => $opcode_stats['hit_hit'] < 0.8)); } if (isset($opcode_stats['memory_total'])) { $opcode_stats = array_merge($opcode_stats, array('warning_starve' => $opcode_stats['memory_avail'] < 0.2, 'warning_low' => $opcode_stats['memory_total'] < 60 * 1024 * 1024)); } $stat_flag = $opcode_stats['stat_flag']; if ($stat_flag) { $opcode_stats['warning_check'] = (bool) ini_get($stat_flag); } return $opcode_stats; }
function CPerfAccelWinCache() { $wincache_enabled = ini_get('wincache.ocenabled'); $memory = wincache_ocache_meminfo(); parent::CPerfAccel(!($wincache_enabled == "0" || strtolower($wincache_enabled) == "off"), -1, -1, true, $memory["memory_total"], $memory["memory_total"] - $memory["memory_free"]); }
public static function CPerfAccelWinCache() { $wincache_enabled = ini_get('wincache.ocenabled'); $memory = wincache_ocache_meminfo(); parent::CPerfAccel( !($wincache_enabled=="0" || strtolower($wincache_enabled)=="off"), -1, -1, true, //Because there is no way to turn on check file mtime we'll assume it's ok $memory["memory_total"], $memory["memory_total"] - $memory["memory_free"] ); }