From 082f0a3332d6ce78b06b984d650f583e0f6f77c1 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Mon, 15 Jul 2024 23:02:17 +0200 Subject: [PATCH] Outputting elapsed time under the same conditions as used memory --- src/Command/InceptionResult.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Command/InceptionResult.php b/src/Command/InceptionResult.php index 6abde5aefb..14a1d5202d 100644 --- a/src/Command/InceptionResult.php +++ b/src/Command/InceptionResult.php @@ -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)), )); }