Skip to content

Firefly III: a personal finances manager

Add execution times to see which commands really suck.

James Cole06eca2be44f0
diff --git a/app/Console/Commands/Correction/CorrectsDatabase.php b/app/Console/Commands/Correction/CorrectsDatabase.php
index 89d2818f07..8637bf0253 100644
--- a/app/Console/Commands/Correction/CorrectsDatabase.php
+++ b/app/Console/Commands/Correction/CorrectsDatabase.php
@@ -83,7 +83,10 @@ class CorrectsDatabase extends Command
];
foreach ($commands as $command) {
$this->friendlyLine(sprintf('Now executing command "%s"', $command));
+ $time = microtime(true);
$this->call($command);
+ $time = microtime(true) - $time;
+ $this->friendlyLine(sprintf('Command %s took %.4f seconds.', $command, $time));
}
return 0;
diff --git a/app/Console/Commands/Integrity/ReportsIntegrity.php b/app/Console/Commands/Integrity/ReportsIntegrity.php
index 6f66b89df1..8a74112398 100644
--- a/app/Console/Commands/Integrity/ReportsIntegrity.php
+++ b/app/Console/Commands/Integrity/ReportsIntegrity.php
@@ -47,8 +47,11 @@ class ReportsIntegrity extends Command
}
$commands = ['integrity:empty-objects', 'integrity:total-sums', 'integrity:file-permissions'];
foreach ($commands as $command) {
- $this->friendlyLine(sprintf('Now executing %s', $command));
+ $this->friendlyLine(sprintf('Now executing command %s', $command));
+ $time = microtime(true);
$this->call($command);
+ $time = microtime(true) - $time;
+ $this->friendlyLine(sprintf('Command %s took %.4f seconds.', $command, $time));
}
return 0;
diff --git a/app/Console/Commands/Upgrade/UpgradesDatabase.php b/app/Console/Commands/Upgrade/UpgradesDatabase.php
index e77f53c37b..4c02bd6ced 100644
--- a/app/Console/Commands/Upgrade/UpgradesDatabase.php
+++ b/app/Console/Commands/Upgrade/UpgradesDatabase.php
@@ -30,7 +30,6 @@ use FireflyIII\Support\System\GeneratesInstallationId;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use Safe\Exceptions\InfoException;
-
use function Safe\set_time_limit;
try {
@@ -85,11 +84,14 @@ class UpgradesDatabase extends Command
$args = ['--force' => true];
}
foreach ($commands as $command) {
- $this->friendlyLine(sprintf('Now executing %s', $command));
+ $this->friendlyLine(sprintf('Now executing command %s', $command));
+ $time = microtime(true);
$this->call($command, $args);
+ $time = round((microtime(true) - $time), 2);
+ $this->friendlyLine(sprintf('Command %s took %.4f seconds.', $command, $time));
}
// index will set FF3 version.
- AppConfiguration::set('ff3_build_time', (int) config('firefly.build_time'));
+ AppConfiguration::set('ff3_build_time', (int)config('firefly.build_time'));
$this->generateInstallationId();
return 0;