Skip to content

Commit

Permalink
Outputting elapsed time under the same conditions as used memory
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jul 15, 2024
1 parent ef2a246 commit 082f0a3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Command/InceptionResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,17 @@ public function getGenerateBaselineFile(): ?string

public function handleReturn(int $exitCode, ?int $peakMemoryUsageBytes, float $analysisStartTime): int
{
if ($peakMemoryUsageBytes !== null && $this->getErrorOutput()->isVerbose()) {
if ($this->getErrorOutput()->isVerbose()) {
$this->getErrorOutput()->writeLineFormatted(sprintf(
'Used memory: %s',
BytesHelper::bytes(max(memory_get_peak_usage(true), $peakMemoryUsageBytes)),
'Elapsed time: %s',
$this->formatDuration((int) round(microtime(true) - $analysisStartTime)),
));
}

if ($this->getErrorOutput()->isDebug()) {
if ($peakMemoryUsageBytes !== null && $this->getErrorOutput()->isVerbose()) {
$this->getErrorOutput()->writeLineFormatted(sprintf(
'Analysis time: %s',
$this->formatDuration((int) round(microtime(true) - $analysisStartTime)),
'Used memory: %s',
BytesHelper::bytes(max(memory_get_peak_usage(true), $peakMemoryUsageBytes)),
));
}

Expand Down

0 comments on commit 082f0a3

Please sign in to comment.