class StopwatchPeriod

Class StopwatchPeriod

Hierarchy

Expanded class hierarchy of StopwatchPeriod

File

webprofiler/src/Stopwatch.php, line 489

Namespace

Drupal\webprofiler
View source
class StopwatchPeriod {
    private $start;
    private $end;
    private $memory;
    
    /**
     * Constructor.
     *
     * @param integer $start The relative time of the start of the period (in milliseconds)
     * @param integer $end The relative time of the end of the period (in milliseconds)
     */
    public function __construct($start, $end) {
        $this->start = (int) $start;
        $this->end = (int) $end;
        $this->memory = memory_get_usage(TRUE);
    }
    
    /**
     * Gets the relative time of the start of the period.
     *
     * @return integer The time (in milliseconds)
     */
    public function getStartTime() {
        return $this->start;
    }
    
    /**
     * Gets the relative time of the end of the period.
     *
     * @return integer The time (in milliseconds)
     */
    public function getEndTime() {
        return $this->end;
    }
    
    /**
     * Gets the time spent in this period.
     *
     * @return integer The period duration (in milliseconds)
     */
    public function getDuration() {
        return $this->end - $this->start;
    }
    
    /**
     * Gets the memory usage.
     *
     * @return integer The memory usage (in bytes)
     */
    public function getMemory() {
        return $this->memory;
    }

}

Members

Title Sort descending Modifiers Object type Summary
StopwatchPeriod::$end private property
StopwatchPeriod::$memory private property
StopwatchPeriod::$start private property
StopwatchPeriod::getDuration public function Gets the time spent in this period.
StopwatchPeriod::getEndTime public function Gets the relative time of the end of the period.
StopwatchPeriod::getMemory public function Gets the memory usage.
StopwatchPeriod::getStartTime public function Gets the relative time of the start of the period.
StopwatchPeriod::__construct public function Constructor.