From 772a59c868d1cce75b71eb167d951f534e3ebd65 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Tue, 23 Aug 2022 09:39:41 +0000 Subject: [PATCH] Add time to stats --- lib/Command/Index.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/Command/Index.php b/lib/Command/Index.php index 5d4da1a8..d8768c21 100644 --- a/lib/Command/Index.php +++ b/lib/Command/Index.php @@ -121,6 +121,9 @@ class Index extends Command { exit(1); } + // Time measurement + $startTime = microtime(true); + if ($this->encryptionManager->isEnabled()) { $output->writeln('Encryption is enabled. Aborted.'); return 1; @@ -134,6 +137,17 @@ class Index extends Command { // Close the exiftool process \OCA\Memories\Exif::closeStaticExiftoolProc(); + // Show some stats + $endTime = microtime(true); + $execTime = intval(($endTime - $startTime)*1000)/1000 ; + $nTotal = $this->nInvalid + $this->nSkipped + $this->nProcessed; + $this->output->writeln("=========================================="); + $this->output->writeln("Checked $nTotal files in $execTime sec"); + $this->output->writeln($this->nInvalid . " not valid media items"); + $this->output->writeln($this->nSkipped . " skipped because unmodified"); + $this->output->writeln($this->nProcessed . " (re-)processed"); + $this->output->writeln("=========================================="); + return 0; } @@ -143,14 +157,6 @@ class Index extends Command { $userFolder = $this->rootFolder->getUserFolder($user->getUID()); $this->parseFolder($userFolder); - - $nTotal = $this->nInvalid + $this->nSkipped + $this->nProcessed; - $this->output->writeln("=========================================="); - $this->output->writeln("Checked $nTotal files"); - $this->output->writeln($this->nInvalid . " not valid media items"); - $this->output->writeln($this->nSkipped . " skipped because unmodified"); - $this->output->writeln($this->nProcessed . " (re-)processed"); - $this->output->writeln("=========================================="); } private function parseFolder(Folder &$folder): void {