コード例 #1
0
 /**
  * PerformanceInfo constructor.
  * @param float $created
  * @param float $timePassed
  * @param int $numClassesTotal
  * @param int $numFilesIncluded
  * @param float $memoryAllocated
  */
 public function __construct($created, $timePassed, $numClassesTotal, $numFilesIncluded, $memoryAllocated)
 {
     $this->created = $created;
     $this->timePassed = $timePassed;
     $this->numClassesDeclared = $numClassesTotal;
     $this->numFilesIncluded = $numFilesIncluded;
     $this->memoryAllocated = $memoryAllocated;
     $this->peakMemoryAllocation = Utils::toMegaBytes(memory_get_peak_usage());
 }
コード例 #2
0
 /**
  * PerformanceSnapshot constructor.
  * @param PerformanceSnapshotInterface|null $prev
  */
 public function __construct(PerformanceSnapshotInterface $prev = null)
 {
     $this->created = Utils::getMicroTime();
     if ($prev instanceof PerformanceSnapshotInterface) {
         $this->timePassed = bcsub($this->creationTime(), $prev->creationTime(), 4);
     } else {
         $prev = new PerformanceSnapshotNullObject();
         $this->timePassed = 0;
     }
     $this->numClassesDeclaredTotal = count(get_declared_classes());
     $this->numFilesIncludedTotal = count(get_included_files());
     $this->numClassesDeclared = $this->numClassesDeclaredTotal - $prev->numTotalClassesDeclared();
     $this->numFilesIncluded = $this->numFilesIncludedTotal - $prev->numTotalFilesIncluded();
     $this->memoryAllocated = round(memory_get_usage() / 1024 / 1024, 4);
     $this->memoryAllocatedDiff = bcsub($this->memoryAllocated, $prev->memoryAllocated(), 4);
 }
コード例 #3
0
 /**
  * PerformanceSnapshot constructor.
  * @param PerformanceInfoInterface|null $prev
  */
 public function __construct(PerformanceInfoInterface $prev = null)
 {
     $timePassed = 0;
     $creationTime = Utils::getMicroTime();
     if ($prev instanceof PerformanceInfoInterface) {
         $timePassed = bcsub($creationTime, $prev->creationTime(), 4);
     } else {
         $prev = new NullPerformanceInfoObject();
     }
     $numClassesDeclared = count(get_declared_classes());
     $numFilesIncluded = count(get_included_files());
     $this->numClassesDeclaredSincePreviousSnapShot = $numClassesDeclared - $prev->numClassesDeclared();
     $this->numFilesIncludedSincePreviousSnapShot = $numFilesIncluded - $prev->numFilesIncluded();
     $memoryAllocated = Utils::toMegaBytes(memory_get_usage());
     $this->memoryAllocatedDiff = bcsub($memoryAllocated, $prev->memoryAllocated(), 4);
     parent::__construct($creationTime, $timePassed, $numClassesDeclared, $numFilesIncluded, $memoryAllocated);
 }
コード例 #4
0
ファイル: Monitor.php プロジェクト: parkerj/eduTrac-SIS
 /**
  * @inheritDoc
  */
 public function getPerformanceInfo()
 {
     return new PerformanceInfo(Utils::getMicroTime(), bcsub(Utils::getMicroTime(), $this->startTime, 4), count(get_declared_classes()), count(get_included_files()), round(memory_get_usage() / 1024 / 1024, 4));
 }