コード例 #1
0
ファイル: measure.php プロジェクト: mrdeadmouse/u136006
 function __construct()
 {
     $memory = array("memorySize" => intval(ini_get('opcache.memory_consumption')) * 1024 * 1024, "memoryAllocated" => -1);
     parent::__construct(ini_get('opcache.enable') != "0", -1, -1, ini_get('opcache.validate_timestamps') != "0", $memory["memorySize"], $memory["memoryAllocated"], -1);
 }
コード例 #2
0
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/perfmon/include.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/perfmon/prolog.php";
IncludeModuleLangFile(__FILE__);
$RIGHT = $APPLICATION->GetGroupRight("perfmon");
if ($RIGHT == "D") {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
$data = array("tuning" => array("NAME" => GetMessage("PERFMON_PHP_TUNING_NAME"), "TITLE" => GetMessage("PERFMON_PHP_TUNING_TITLE"), "HEADERS" => array(array("id" => "PARAMETER", "content" => GetMessage("PERFMON_PHP_TUNING_PARAMETER"), "default" => true), array("id" => "VALUE", "content" => GetMessage("PERFMON_PHP_TUNING_VALUE"), "align" => "right", "default" => true), array("id" => "RECOMMENDATION", "content" => GetMessage("PERFMON_PHP_TUNING_RECOMMENDATION"), "default" => true)), "ITEMS" => array()));
$php_version = phpversion();
$is_ok = version_compare($php_version, "5.3.0", ">=");
$data["tuning"]["ITEMS"][] = array("PARAMETER" => GetMessage("PERFMON_PHP_VERSION"), "IS_OK" => $is_ok, "VALUE" => $is_ok ? $php_version : "<span class=\"errortext\">" . $php_version . "</span>", "RECOMMENDATION" => GetMessage("PERFMON_PHP_VERSION_REC", array("#value#" => "5.3.0")));
$open_basedir = ini_get('open_basedir');
$is_ok = strlen($open_basedir) <= 0;
$data["tuning"]["ITEMS"][] = array("PARAMETER" => "open_basedir", "IS_OK" => $is_ok, "VALUE" => "&nbsp;" . $open_basedir, "RECOMMENDATION" => GetMessage("PERFMON_PHP_OPEN_BASEDIR_REC"));
if (version_compare($php_version, "5.1.0", ">=")) {
    $size = CPerfAccel::unformat(ini_get('realpath_cache_size'));
    $is_ok = $size >= 4 * 1024 * 1024;
    $data["tuning"]["ITEMS"][] = array("PARAMETER" => "realpath_cache_size", "IS_OK" => $is_ok, "VALUE" => ini_get('realpath_cache_size'), "RECOMMENDATION" => GetMessage("PERFMON_PHP_PATH_CACHE_REC2"));
}
$arKnownAccels = array('apc' => '<a href="http://pecl.php.net/package/APC">APC</a>', 'xcache' => '<a href="http://xcache.lighttpd.net/">XCache</a>', 'zend_accelerator' => '<a href="http://www.zend.com/products/platform">Zend Accelerator</a>', 'wincache' => '<a href="http://learn.iis.net/page.aspx/678/using-windows-cache-extension-for-php/">Windows Cache Extension for PHP</a>', 'zendopcache' => '<a href="http://pecl.php.net/package/ZendOpcache">ZendOpcache</a>');
$allAccelerators = CPerfomanceMeasure::GetAllAccelerators();
if (!$allAccelerators) {
    $data["tuning"]["ITEMS"][] = array("PARAMETER" => GetMessage("PERFMON_PHP_PRECOMPILER"), "IS_OK" => false, "VALUE" => GetMessage("PERFMON_PHP_PRECOMPILER_NOT_INSTALLED"), "RECOMMENDATION" => GetMessage("PERFMON_PHP_PRECOMPILER_REC") . "<br>" . implode("<br>", $arKnownAccels));
} else {
    $workingAccel = null;
    foreach ($allAccelerators as $accel) {
        if ($accel->IsWorking()) {
            $workingAccel = $accel;
            $arRecommendations = $accel->GetRecommendations();
            foreach ($arRecommendations as $i => $ar) {
                $data["tuning"]["ITEMS"][] = $ar;
コード例 #3
0
ファイル: measure.php プロジェクト: k-kalashnikov/geekcon_new
 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"]);
 }
コード例 #4
0
ファイル: measure.php プロジェクト: akniyev/itprom_dobrohost
 function GetRecommendations()
 {
     $arResult = parent::GetRecommendations();
     if (extension_loaded('Zend OPcache')) {
         $max_accelerated_files = intval(ini_get('opcache.max_accelerated_files'));
         $rec_accelerated_files = 100000;
         $is_ok = $max_accelerated_files >= $rec_accelerated_files;
         array_unshift($arResult, array("PARAMETER" => "opcache.max_accelerated_files", "IS_OK" => $is_ok, "VALUE" => $max_accelerated_files, "RECOMMENDATION" => GetMessage("PERFMON_MEASURE_EQUAL_OR_GREATER_THAN_REC", array("#value#" => $rec_accelerated_files))));
         if (function_exists('opcache_get_status')) {
             $cacheStatus = opcache_get_status(false);
             $cachedKeys = intval($cacheStatus['opcache_statistics']['num_cached_keys']);
             $maxKeys = intval($cacheStatus['opcache_statistics']['max_cached_keys']);
             $is_ok = $cachedKeys <= 0 || $maxKeys <= 0 || $cachedKeys < $maxKeys;
             if (!$is_ok) {
                 array_unshift($arResult, array("PARAMETER" => "opcache.max_accelerated_files", "IS_OK" => $is_ok, "VALUE" => $maxKeys, "RECOMMENDATION" => GetMessage("PERFMON_MEASURE_EQUAL_OR_GREATER_THAN_REC", array("#value#" => $cachedKeys))));
             }
         }
     }
     return $arResult;
 }
コード例 #5
0
ファイル: measure.php プロジェクト: ASDAFF/bxApiDocs
	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"]
		);
	}