Page MenuHomePhabricator
Paste P10713

l10n-php opcache stats (T99740)
ActivePublic

Authored by Krinkle on Mar 17 2020, 9:17 PM.
Tags
None
Referenced Files
F31687961: raw.txt
Mar 17 2020, 10:20 PM
F31687947: raw.txt
Mar 17 2020, 10:15 PM
F31687945: raw.txt
Mar 17 2020, 10:15 PM
F31687878: raw.txt
Mar 17 2020, 9:28 PM
F31687863: raw.txt
Mar 17 2020, 9:18 PM
F31687859: raw.txt
Mar 17 2020, 9:17 PM
Subscribers
None
<?php
define( 'MW_NO_SESSION', 1 );
require_once __DIR__ . '/../multiversion/MWMultiVersion.php';
require MWMultiVersion::getMediaWiki( 'includes/WebStart.php' );
header( 'Content-Type: text/plain; charset=utf-8' );
function kfFmtBytes($num) {
if ($num < 1024) {
return $num . 'B';
}
$num /= 1024;
if ($num < 1024) {
return round($num) . 'KB';
}
$num /= 1024;
return round($num) . 'MB';
}
function kfDumpStuff(string $section) {
$oc = opcache_get_status();
$ac = apcu_sma_info();
$out = '
Opcache is enabled: '.(int)$oc['opcache_enabled'].'
Opcache is full: '.(int)$oc['cache_full'].'
Opcache memory used: '.kfFmtBytes($oc['memory_usage']['used_memory']).' / Opcache memory free: '.kfFmtBytes($oc['memory_usage']['free_memory']).'
Opcache strings mem used: '.kfFmtBytes($oc['interned_strings_usage']['used_memory']).' / Opcache strings mem free: '.kfFmtBytes($oc['interned_strings_usage']['free_memory']).'
';
echo "\n### $section\n";
echo trim($out) . "\n\n";
}
kfDumpStuff('Initial');
$files = array_merge(
glob("/srv/mediawiki/php-1.35.0-wmf.22/cache/l10n/*.php"),
glob("/srv/mediawiki/php-1.35.0-wmf.23/cache/l10n/*.php")
);
if (!$files)
die('No files found.');
echo 'Found ' . count($files) . " files.\n";
$chunks = array_chunk($files, 10);
echo 'Created ' . count($chunks) . " chunks of 10 files each.\n\n";
foreach (
$chunks
as
$i => $chunk
) {
#echo "Loading:\n";
foreach ($chunk as $file) {
#echo " * $file\n";
opcache_compile_file($file) or die("Failed to compile: $file");
}
kfDumpStuff('After chunk #' . $i);
if ( $i > 10 ) {
break;
}
}