function BaseParser::trimRun in XHProf 8
Parameters
Symbol[] $symbols:
$functions_to_keep:
Return value
array
1 call to BaseParser::trimRun()
- Parser::parse in src/
XHProfLib/ Parser/ Parser.php
File
- src/
XHProfLib/ Parser/ BaseParser.php, line 254
Class
- BaseParser
- Class BaseReport
Namespace
Drupal\xhprof\XHProfLib\ParserCode
function trimRun($symbols, $functions_to_keep) {
// convert list of functions to a hash with function as the key
$function_map = array_fill_keys($functions_to_keep, 1);
// always keep main() as well so that overall totals can still
// be computed if need be.
$function_map['main()'] = 1;
$new_symbols = [];
foreach ($symbols as $symbol) {
$parent = $symbol
->getParent();
$child = $symbol
->getChild();
if (isset($function_map[$parent]) || isset($function_map[$child])) {
$new_symbols["{$parent}==>{$child}"] = $symbol;
}
}
return $new_symbols;
}