Created
September 27, 2017 14:40
-
-
Save BigWhale/dd0e4fbec15d9cd6c4df041b7683cb2d to your computer and use it in GitHub Desktop.
WordPress theme memory usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'shutdown', 'do_shutdown', 999); | |
function do_shutdown() { | |
$f = fopen('/tmp/memory_usage.txt', 'a+'); | |
$usage = memory_get_peak_usage( true ); | |
fwrite( $f, $usage / 1024 / 1024 . " MB\n" ); | |
fclose( $f ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment