Example #1
0
 /**
  * Subtracts a snapshot from another one.
  *
  * The result will be a snapshot describing the execution metrics between the two snapshots
  * e.g. execution-time between two snapshots, memory-consumption from one snapshot to another etc.
  *
  * @param Snapshot $other
  *
  * @return Snapshot
  */
 public function diff(Snapshot $other)
 {
     return new self($this->_time - $other->getTime(), $this->_memoryUsage - $other->getMemoryUsage(), $this->_realMemoryUsage - $other->getRealMemoryUsage(), ($this->_memoryUsagePeak + $other->getMemoryUsagePeak()) / 2, ($this->_realMemoryUsagePeak + $other->getRealMemoryUsagePeak()) / 2);
 }