Skip to content

Commit 8b7555f

Browse files
committed
Execution Time
Add logic to calculate total time taken to import .ged file
1 parent b784116 commit 8b7555f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Utils/GedcomParser.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class GedcomParser
3131

3232
public function parse($conn, string $filename, string $slug, bool $progressBar = false)
3333
{
34+
//start calculating the time
35+
$time_start = microtime(true);
36+
3437
$this->conn = $conn;
3538
error_log('PARSE LOG : +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'.$conn);
3639
$parser = new \PhpGedcom\Parser();
@@ -214,6 +217,11 @@ public function parse($conn, string $filename, string $slug, bool $progressBar =
214217
}
215218

216219
if ($progressBar === true) {
220+
//Record end time and calculate total execution time
221+
$time_end = microtime(true);
222+
$execution_time = ($time_end - $time_start);
223+
error_log("\nTotal Execution Time: " . round($execution_time) . " Seconds");
224+
217225
$bar->finish();
218226
}
219227
}

0 commit comments

Comments
 (0)