You are here

protected function BaseParser::computeInclusiveTimes in XHProf 8

Parameters

Symbol[] $symbols:

Return value

array

1 call to BaseParser::computeInclusiveTimes()
BaseParser::computeFlatInfo in src/XHProfLib/Parser/BaseParser.php

File

src/XHProfLib/Parser/BaseParser.php, line 215

Class

BaseParser
Class BaseReport

Namespace

Drupal\xhprof\XHProfLib\Parser

Code

protected function computeInclusiveTimes($symbols) {
  $metrics = $this
    ->getMetrics();
  $symbol_tab = [];

  /*
   * First compute inclusive time for each function and total
   * call count for each function across all parents the
   * function is called from.
   */
  foreach ($symbols as $symbol) {
    $child = $symbol
      ->getChild();
    if (!isset($symbol_tab[$child])) {
      $symbol_tab[$child] = [
        "ct" => $symbol
          ->getCt(),
      ];
      foreach ($metrics as $metric) {
        $symbol_tab[$child][$metric] = $symbol
          ->getMetric($metric);
      }
    }
    else {

      // increment call count for this child
      $symbol_tab[$child]["ct"] += $symbol
        ->getCt();

      // update inclusive times/metric for this child
      foreach ($metrics as $metric) {
        $symbol_tab[$child][$metric] += $symbol
          ->getMetric($metric);
      }
    }
  }
  return $symbol_tab;
}