Skip to content

Instantly share code, notes, and snippets.

@jbenesch
Created October 26, 2015 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbenesch/f6100cce47a6a894f0ba to your computer and use it in GitHub Desktop.
Save jbenesch/f6100cce47a6a894f0ba to your computer and use it in GitHub Desktop.
Simple php inspection
function performance($label) {
$time = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"];
$memory = memory_get_usage();
$functions = get_defined_functions();
echo "<pre>";
echo "LABEL: $label\n";
echo "TIME: $time\n";
echo "MEM: $memory\n";
print_r(array_diff($functions["user"], $GLOBALS['remove_wp_funcs']));
print_r(array_reverse(debug_backtrace()));
unset($GLOBALS['remove_wp_funcs']);
unset($GLOBALS['functions']);
unset($GLOBALS['wp_filter']);
unset($GLOBALS['allowedposttags']);
unset($GLOBALS['allowedtags']);
unset($GLOBALS['allowedentitynames']);
print_r($GLOBALS);
echo "</pre>";
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment