/** * Get name of active opcode cache, or "none". * {@internal Anyone using something else, please extend.}} * @return string */ function get_active_opcode_cache() { if (function_exists('apc_cache_info') && ini_get('apc.enabled')) { // fp>blueyed? why did you remove the following 2 lines? your comment above is not clear. $apc_info = apc_cache_info('', true); if (isset($apc_info['num_entries']) && $apc_info['num_entries']) { return 'APC'; } } // xcache: xcache.var_size must be > 0. xcache_set is not necessary (might have been disabled). if (ini_get('xcache.size') > 0) { return 'xcache'; } if (ini_get('eaccelerator.enable')) { $eac_info = eaccelerator_info(); if ($eac_info['cache']) { return 'eAccelerator'; } } return 'none'; }
public function getInfo() { return eaccelerator_info(); }
/** * Get stats and usage Informations for display from eAccelerator */ public function stats() { // get info Get info about eAccelerator $eac_sysinfos['infos'] = eaccelerator_info(); // List cached keys $keys = eaccelerator_list_keys(); if (is_array($keys)) { foreach ($keys as $key) { $eac_sysinfo['keys'][] = $key; } } return null; }
$pw = "eAccelerator"; /** /config **/ /* {{{ auth */ if ($auth && !isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER'] != $user || $_SERVER['PHP_AUTH_PW'] != $pw) { header('WWW-Authenticate: Basic realm="eAccelerator control panel"'); header('HTTP/1.0 401 Unauthorized'); exit; } /* }}} */ /* section = script cache */ $sec = 1; if (!function_exists('eaccelerator_info')) { die('eAccelerator isn\'t installed or isn\'t compiled with info support!'); } // Global info array $info = eaccelerator_info(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>eAccelerator control panel</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Content-Language" content="en" /> <style type="text/css" media="all"> body {background-color: #ffffff; color: #000000;margin: 0px;} body, td {font-family: Tahoma, sans-serif;font-size: 12pt;} a:link {color: #ff0000; text-decoration: none;} a:visited {color: #ff0000; text-decoration: none;}
} } if (isset($_POST['clear'])) { authorize(); eaccelerator_clear(); } if (isset($_POST['clean'])) { authorize(); eaccelerator_clean(); } if (isset($_POST['purge'])) { authorize(); eaccelerator_purge(); } } $Opcode = eaccelerator_info(); $CachedScripts = eaccelerator_cached_scripts(); //$RemovedScripts = eaccelerator_removed_scripts(); show_header("Opcode Stats"); ?> <div class="thin"> <div> <form action="" method="post"> <div> <input type="hidden" name="action" value="opcode_stats" /> <input type="hidden" name="auth" value="<?php echo $LoggedUser['AuthKey']; ?> " /> </div> <table cellpadding="6" cellspacing="1" border="0" class="border" width="100%">
public function info() { $info = array(); $info['info'] = eaccelerator_info(); $info['keys'] = eaccelerator_list_keys(); $info['script'] = eaccelerator_cached_scripts(); $info['script_remove'] = eaccelerator_removed_scripts(); return $info; }
function stats() { $eacc_stats = eaccelerator_info(); $stats = array('uptime' => time(), 'bytes_used' => $eacc_stats['memoryAllocated'], 'bytes_total' => $eacc_stats['memorySize'], 'gets' => 0, 'sets' => 0, 'hits' => 0, 'misses' => 0, 'req_rate' => 0, 'hit_rate' => 0, 'miss_rate' => 0, 'set_rate' => 0); return $stats; }
function CPerfAccelEAccel() { if (function_exists("eaccelerator_info")) { $memory = eaccelerator_info(); } else { $memory = array("memorySize" => intval(ini_get('eaccelerator.shm_size')) * 1024 * 1024, "memoryAllocated" => -1); } $obCache = new CPHPCache(); if (strtolower(get_class($obCache->_cache)) == "cphpcacheeaccelerator") { $cache_limit = intval(ini_get('eaccelerator.shm_max')); } else { $cache_limit = -1; } parent::CPerfAccel(ini_get('eaccelerator.enable') != "0", intval(ini_get('eaccelerator.shm_ttl')), -1, ini_get('eaccelerator.check_mtime') != "0", $memory["memorySize"], $memory["memoryAllocated"], $cache_limit); }
/** */ function _debug_eaccelerator(&$params = []) { if (!$this->SHOW_EACCELERATOR_INFO || !function_exists('eaccelerator_info')) { return ''; } $eaccel_stats = eaccelerator_info(); foreach ((array) ini_get_all('eaccelerator') as $_k => $_v) { $eaccel_stats[$_k] = $_v['local_value']; } return $this->_show_key_val_table($eaccel_stats); }
function onPageComplete($page = false) { global $debug_total_time; global $debug_total_sql_query; global $debug_sql_query_stack; $debug_total_string = ''; if (isset($debug_total_time) && $debug_total_time) { $time = microtime(true) - $debug_total_time; $debug_total_memory = function_exists('memory_get_peak_usage') ? memory_get_peak_usage() : 0; $debug_total_string .= sprintf('<div style="z-index:9999;position:fixed;right:50px;top:5px;height:23px;padding:0px;padding-bottom:2px;font-weight:bolder;color:green;background-color:#000033;opacity:0.8;border:1px dotted grey;"><span style="padding-left:10px;color:%s;">%0.3f s</span>' . "\t", $time > 0.5 ? $time > 1 ? 'red' : 'yellow' : 'green', $time); if ($debug_total_memory) { $debug_total_memory /= 1048576; $debug_total_string .= sprintf('<span style="padding-left:10px;color:%s;"> %0.3f MB</span>' . "\t", $debug_total_memory > 8 ? $debug_total_memory > 16 ? 'red' : 'yellow' : 'green', $debug_total_memory); } if (extension_loaded('eAccelerator')) { $eaccelerator_info = eaccelerator_info(); if ($eaccelerator_info['cache']) { $debug_total_string .= sprintf('<span style="padding-left:10px;color:%s;"> eAccelerator %s [%0.2fMB(%d%%)/%d scripts]</span>' . "\t" . "\n", 'cyan', $eaccelerator_info['version'], $eaccelerator_info['memoryAllocated'] / 1048576, 100 * $eaccelerator_info['memoryAllocated'] / $eaccelerator_info['memorySize'], $eaccelerator_info['cachedScripts']); } } elseif (extension_loaded('xCache')) { if (isset($_GET['xcache'])) { $pcnt = xcache_count(XC_TYPE_PHP); $total = array('size' => 0, 'avail' => 0, 'cached' => 0, 'slots' => 0); $fields = array('size', 'avail', 'cached', 'slots'); for ($i = 0; $i < $pcnt; $i++) { $data = xcache_info(XC_TYPE_PHP, $i); foreach ($fields as $field) { $total[$field] += $data[$field]; } } $total['used'] = $total['size'] - $total['avail']; $version = phpversion('xcache'); $debug_total_string .= sprintf('<span style="padding-left:10px;color:%s;"> xCache %s [%0.2fMB(%d%%)/%d scripts]</span>' . "\t" . "\n", 'cyan', $version, $total['used'] / 1048576, 100 * $total['used'] / $total['size'], $total['cached']); } else { $version = phpversion('xcache'); $debug_total_string .= sprintf('<span style="padding-left:10px;color:%s;"> xCache %s</span>' . "\t" . "\n", 'cyan', $version); } } $debug_total_string .= sprintf('<span style="padding-left:10px;color:%s;"> %d SQL query</span>' . "\t" . "\n", $debug_total_sql_query > 50 ? $debug_total_sql_query > 100 ? 'red' : 'yellow' : 'green', $debug_total_sql_query); $debug_total_string .= sprintf('<span style="padding-left:10px;"> %d File(s)</span>' . "\t" . "\n", count(get_included_files())); $page_size = ob_get_length(); $debug_total_string .= sprintf('<span style="padding-left:10px;"> %0.3f KB page size</span>' . "\t", ($page_size ? $page_size : strlen($page)) / 1024); //$debug_total_string .= sprintf('<span style="padding-left:10px;"> %s mode</span>',false?'DEV':'PRODUCTION'); $debug_total_string .= '<img style="padding:0;padding-left:10px;margin:0;cursor:pointer;" src="' . URL_IMAGES_COMMON . '/close.gif" title="close" alt="close" onclick="this.parentNode.style.display=\'none\';"></div>'; $firebug_enabled = false; if (class_exists('FirePHP')) { $firebug_enabled = strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'firephp') === false ? false : true; $firebug = FirePHP::getInstance(true); $firebug_enabled = $firebug->detectClientExtension(); $firebug->setEnabled($firebug_enabled); $firebug->info(strip_tags($debug_total_string), basename(__FILE__)); if ($debug_sql_query_stack && (isset($_COOKIE['debug']) && $_COOKIE['debug'] == 'sql')) { $total = 0.0; foreach ($debug_sql_query_stack as $stack_item) { $total += $stack_item['time']; } $debug_sql_query_stack[] = array('#' => 'TOTAL', 'time' => sprintf('%0.2f', $total), 'query' => ''); $firebug->table('SQL', $debug_sql_query_stack); } } if (!SystemSettings::is_hosted() && (isset($_COOKIE['debug']) && $_COOKIE['debug'] == 'log') && ($fp = @fopen(DIR_TEMP . '/access.' . date("Y.m.d") . '.log', "a"))) { @fwrite($fp, date("Y-m-d H:i:s") . "\t" . $_REQUEST['REQUEST_URI'] . $_REQUEST['QUERY_STRING'] . "\t" . preg_replace('/\\s+/', ' ', strip_tags($debug_total_string)) . "\n"); if ($debug_sql_query_stack) { foreach ($debug_sql_query_stack as $query) { @fwrite($fp, "\t" . implode("\t", $query) . "\n\n"); } @fwrite($fp, "\n\n==========================================\n"); } @fclose($fp); } } session_write_close(); if ($page) { if (!$firebug_enabled) { print preg_replace('@</body>\\s*</html>\\s*$@', '', $page); print $debug_total_string . ' </body> </html>'; } else { print $page; return $debug_total_string; } } }
public function stats() { return eaccelerator_info(); }
/** * Get stats and usage Informations for display from eAccelerator. */ public function stats() { $infos = []; $infos['infos'] = eaccelerator_info(); $keys = eaccelerator_list_keys(); if (is_array($keys)) { foreach ($keys as $key) { $infos['keys'][] = $key; } } return $infos; }
/** * Implementation specific array of statistics * * @return array An associative array of statistics, determined by the * implementation */ public function getStats() { return array_merge(eaccelerator_info(), ini_get_all('eaccelerator')); }
function get_ea_info($name) { $ea_info = eaccelerator_info(); return $ea_info[$name]; }
/** * Return the filling percentage of the backend storage * * @throws \Zend_Cache_Exception * @return int integer between 0 and 100 */ public function getFillingPercentage() { $mem = eaccelerator_info(); $memSize = $mem['memorySize']; $memAvailable = $mem['memoryAvailable']; $memUsed = $memSize - $memAvailable; if ($memSize == 0) { \Zend_Cache::throwException('can\'t get eaccelerator memory size'); } if ($memUsed > $memSize) { return 100; } return (int) (100.0 * ($memUsed / $memSize)); }
function __construct() { if (function_exists("eaccelerator_info")) { $memory = eaccelerator_info(); } else { $memory = array("memorySize" => intval(ini_get('eaccelerator.shm_size')) * 1024 * 1024, "memoryAllocated" => -1); } if (\Bitrix\Main\Data\Cache::getCacheEngineType() == "cacheengineeaccelerator") { $cache_limit = intval(ini_get('eaccelerator.shm_max')); } else { $cache_limit = -1; } parent::__construct(ini_get('eaccelerator.enable') != "0", intval(ini_get('eaccelerator.shm_ttl')), -1, ini_get('eaccelerator.check_mtime') != "0", $memory["memorySize"], $memory["memoryAllocated"], $cache_limit); }
<?php $auth = true; $user = ""; $pw = ""; if ($auth && (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_USER'] != $user || $_SERVER['PHP_AUTH_PW'] != $pw)) { header('WWW-Authenticate: Basic realm="eAccelerator control panel"'); header('HTTP/1.0 401 Unauthorized'); exit; } if (!function_exists("eaccelerator_info")) { die("eaccelerator_info() function not found, make sure this script is under eaccelerator.allowed_admin_path"); } $stats = eaccelerator_info(); $var_names = array('memorySize', 'memoryAllocated', 'cachedScripts', 'removedScripts'); foreach ($var_names as $var_name) { print $stats[$var_name] . ' '; }