You are here

class Symbol in XHProf 8

Provides a value object for single span of profiling.

Hierarchy

  • class \Drupal\xhprof\XHProfLib\Symbol\Symbol

Expanded class hierarchy of Symbol

2 files declare their use of Symbol
BaseParser.php in src/XHProfLib/Parser/BaseParser.php
Run.php in src/XHProfLib/Run.php

File

src/XHProfLib/Symbol/Symbol.php, line 8

Namespace

Drupal\xhprof\XHProfLib\Symbol
View source
class Symbol {

  /**
   * @var
   */
  private $parent;

  /**
   * @var
   */
  private $child;

  /**
   * @var
   */
  private $ct;

  /**
   * @var
   */
  private $wt;

  /**
   * @var
   */
  private $cpu;

  /**
   * @var
   */
  private $mu;

  /**
   * @var
   */
  private $pmu;

  /**
   * @param $parent_child
   * @param $ct
   * @param $wt
   * @param $cpu
   * @param $mu
   * @param $pmu
   */
  public function __construct($parent_child, $ct, $wt, $cpu = NULL, $mu = NULL, $pmu = NULL) {
    $this->ct = $ct;
    $this->wt = $wt;
    $this->cpu = $cpu;
    $this->mu = $mu;
    $this->pmu = $pmu;
    list($this->parent, $this->child) = $this
      ->parseParentChild($parent_child);
  }

  /**
   * @return mixed
   */
  public function getParent() {
    return $this->parent;
  }

  /**
   * @return mixed
   */
  public function getChild() {
    return $this->child;
  }

  /**
   * @return mixed
   */
  public function getCpu() {
    return $this->cpu;
  }

  /**
   * @return mixed
   */
  public function getCt() {
    return $this->ct;
  }

  /**
   * @return mixed
   */
  public function getMu() {
    return $this->mu;
  }

  /**
   * @return mixed
   */
  public function getPmu() {
    return $this->pmu;
  }

  /**
   * @return mixed
   */
  public function getWt() {
    return $this->wt;
  }

  /**
   * @param $metric
   *
   * @return mixed
   */
  public function getMetric($metric) {
    if (isset($this->{$metric})) {
      return $this->{$metric};
    }
    else {
      return NULL;
    }
  }

  /**
   * @param $parent_child
   *
   * @return array
   */
  private function parseParentChild($parent_child) {
    $ret = explode("==>", $parent_child);

    // Return if both parent and child are set
    if (isset($ret[1])) {
      return $ret;
    }
    return [
      NULL,
      $ret[0],
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Symbol::$child private property @var
Symbol::$cpu private property @var
Symbol::$ct private property @var
Symbol::$mu private property @var
Symbol::$parent private property @var
Symbol::$pmu private property @var
Symbol::$wt private property @var
Symbol::getChild public function
Symbol::getCpu public function
Symbol::getCt public function
Symbol::getMetric public function
Symbol::getMu public function
Symbol::getParent public function
Symbol::getPmu public function
Symbol::getWt public function
Symbol::parseParentChild private function
Symbol::__construct public function