mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 16:38:32 +00:00
Feat: calculate and log time taken for each project
This commit is contained in:
parent
d4dd7fb757
commit
d77940d22f
1 changed files with 14 additions and 0 deletions
|
|
@ -77,7 +77,21 @@ class StatsResources extends Action
|
|||
// Reset documents for each job
|
||||
$this->documents = [];
|
||||
|
||||
$startTime = microtime(true);
|
||||
$this->countForProject($dbForPlatform, $getLogsDB, $getProjectDB, $project);
|
||||
$endTime = microtime(true);
|
||||
$executionTime = $endTime - $startTime;
|
||||
Console::info('Project: ' . $project->getId() . '(' . $project->getInternalId() . ') aggregated in ' . $this->formatTime($executionTime) .'');
|
||||
}
|
||||
|
||||
public function formatTime($microseconds)
|
||||
{
|
||||
$seconds = $microseconds / 1000000; // Convert microseconds to seconds
|
||||
$hours = floor($seconds / 3600);
|
||||
$minutes = floor(($seconds % 3600) / 60);
|
||||
$remainingSeconds = $seconds % 60;
|
||||
|
||||
return sprintf('%02d:%02d:%06.3f', $hours, $minutes, $remainingSeconds);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue