function xhprof_compute_inclusive_times in XHProf 7
Same name and namespace in other branches
- 6 xhprof.inc \xhprof_compute_inclusive_times()
1 call to xhprof_compute_inclusive_times()
- xhprof_compute_flat_info in ./
xhprof.inc - Analyze hierarchical raw data, and compute per-function (flat) inclusive and exclusive metrics.
File
- ./
xhprof.inc, line 1641
Code
function xhprof_compute_inclusive_times($raw_data) {
$metrics = xhprof_get_metrics($raw_data);
$symbol_tab = array();
/*
* First compute inclusive time for each function and total
* call count for each function across all parents the
* function is called from.
*/
foreach ((array) $raw_data as $parent_child => $info) {
list($parent, $child) = xhprof_parse_parent_child($parent_child);
if ($parent == $child) {
/*
* XHProf PHP extension should never trigger this situation any more.
* Recursion is handled in the XHProf PHP extension by giving nested
* calls a unique recursion-depth appended name (for example, foo@1).
*/
watchdog("Error in Raw Data: parent & child are both: %parent", array(
'%parent' => $parent,
));
return;
}
if (!isset($symbol_tab[$child])) {
$symbol_tab[$child] = array(
"ct" => $info["ct"],
);
foreach ($metrics as $metric) {
$symbol_tab[$child][$metric] = $info[$metric];
}
}
else {
// increment call count for this child
$symbol_tab[$child]["ct"] += $info["ct"];
// update inclusive times/metric for this child
foreach ($metrics as $metric) {
$symbol_tab[$child][$metric] += $info[$metric];
}
}
}
return $symbol_tab;
}