You are here

class Parser in XHProf 8

Hierarchy

Expanded class hierarchy of Parser

2 files declare their use of Parser
Report.php in src/XHProfLib/Report/Report.php
ReportEngine.php in src/XHProfLib/Report/ReportEngine.php

File

src/XHProfLib/Parser/Parser.php, line 7

Namespace

Drupal\xhprof\XHProfLib\Parser
View source
class Parser extends BaseParser {

  /**
   * @param $run
   * @param $sort
   * @param $symbol
   */
  public function __construct(Run $run, $sort, $symbol) {
    parent::__construct($run, $sort, $symbol);
    $this->diff_mode = FALSE;
  }

  /**
   * @return array
   */
  public function parse() {
    if (!empty($this->symbol)) {
      $symbols = $this
        ->trimRun($this->run
        ->getSymbols(), $this->symbol);
    }
    else {
      $symbols = $this->run
        ->getSymbols();
    }
    $data = $this
      ->computeFlatInfo($symbols);

    // @TODO Remove function name sorting.
    if ($this->sort === 'fn') {

      // Functions are array keys.
      \krsort($data);
    }
    else {
      $metric = $this->sort;
      \uasort($data, function ($a, $b) use ($metric) {

        // Arguments swapped to get more expensive values first.
        return $b[$metric] <=> $a[$metric];
      });
    }
    return $data;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BaseParser::$diff_mode protected property
BaseParser::$display_calls protected property
BaseParser::$mainSymbol protected property
BaseParser::$metrics protected property
BaseParser::$overall_totals private property
BaseParser::$pc_stats protected property
BaseParser::$run protected property
BaseParser::$sort protected property
BaseParser::$sort_col protected property
BaseParser::$stats protected property
BaseParser::$symbol protected property
BaseParser::arraySet function
BaseParser::arrayUnset function
BaseParser::computeFlatInfo protected function
BaseParser::computeInclusiveTimes protected function
BaseParser::getDisplayCalls public function
BaseParser::getMetrics public function
BaseParser::getPossibleMetrics public function
BaseParser::getTotals public function
BaseParser::initMetrics protected function
BaseParser::trimRun function
Parser::parse public function Overrides ParserInterface::parse
Parser::__construct public function Overrides BaseParser::__construct