Skip to content

Instantly share code, notes, and snippets.

@dasginganinja
Created March 9, 2023 17:43
Show Gist options
  • Save dasginganinja/c5884ef8fde320b661b16b213ebb3195 to your computer and use it in GitHub Desktop.
Save dasginganinja/c5884ef8fde320b661b16b213ebb3195 to your computer and use it in GitHub Desktop.
<?php
// This code checks for largest opcache consumers
$status = opcache_get_status();
// remap
foreach ($status['scripts'] as $path => $script) {
$sizes[$path] = $script['memory_consumption'];
}
// Sort in descending order
arsort($sizes);
// Show top 20 cache users
$sortedSizes = array_slice($sizes, 0, 20);
?>
<h1>Top 20 Largest OpCached files</h1>
<pre>
<?php var_dump($sortedSizes); ?>
</pre>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment