public function __construct(\XHProf_UI &$ui, array $raw_data1, array $raw_data2) { $ui->diff_mode = true; if (!empty($ui->fn)) { $raw_data1 = Compute::trim_run($raw_data1, array($ui->fn)); $raw_data2 = Compute::trim_run($raw_data2, array($ui->fn)); } $delta = Compute::diff($ui, $raw_data1, $raw_data2); $data1 = Compute::flat_info(&$ui, $raw_data1); $data2 = Compute::flat_info(&$ui, $raw_data2); $data_delta = Compute::flat_info(&$ui, $delta); // data tables // if (!empty($symbol)) { // $info1 = isset($symbol_tab1[$rep_symbol]) ? $symbol_tab1[$rep_symbol] : null; // $info2 = isset($symbol_tab2[$rep_symbol]) ? $symbol_tab2[$rep_symbol] : null; // symbol_report($url_params, $run_delta, $symbol_tab[$rep_symbol], $sort, $rep_symbol, $run1, $info1, $run2, $info2); // // } foreach ($data_delta as $fn => &$info) { $info = $info + array('fn' => $fn); } uasort($data_delta, function ($a, $b) use($ui) { return Utils::sort_cbk($a, $b, $ui); }); $this->_ui = $ui; $this->_data = array($raw_data1, $raw_data2, $data_delta, $data1, $data2); }
public function __construct(\XHProf_UI $ui, array $raw_data) { // if we are reporting on a specific function, we can trim down // the report(s) to just stuff that is relevant to this function. // That way compute_flat_info()/compute_diff() etc. do not have // to needlessly work hard on churning irrelevant data. if (!empty($ui->fn)) { $raw_data = Compute::trim_run($raw_data, array($ui->fn)); } $data = Compute::flat_info($ui, $raw_data); if (!empty($ui->fn) && !isset($data[$ui->fn])) { throw new \Exception('Function ' . $ui->fn . ' not found in XHProf run'); } foreach ($data as $fn => &$info) { $info = $info + array('fn' => $fn); } uasort($data, function ($a, $b) use($ui) { return Utils::sort_cbk($a, $b, $ui); }); $this->_ui = $ui; $this->_data = array($raw_data, $data); }
$base_info = array(); foreach ($ui->metrics as $metric) { $base_info[$metric] = $data[$ui->fn][$metric]; } foreach ($raw_data as $parent_child => $info) { list($parent, $child) = XHProf_UI\Compute::parse_parent_child($parent_child); if ($child == $ui->fn && $parent) { $results['parent'][] = $info + array('fn' => $parent); } if ($parent == $ui->fn) { $results['child'][] = $info + array('fn' => $child); $base_ct['child'] += $info['ct']; } } foreach (array('parent', 'child') as $pc) { \XHProf_UI\Utils::sort($results[$pc], $ui); if (count($results[$pc]) > 0) { ?> <tr><th colspan="<?php echo $colspan; ?> "><?php echo ucfirst($pc); ?> function<?php echo count($results[$pc]) == 1 ? '' : 's'; ?> </th></tr> <?php foreach ($results[$pc] as $info) { ?>