[DOC-WEB] [web-doc] master: More useful timings
[email protected] (Jim Winstead) Tue, 22 Oct 2024 18:19:33 +0000
| Newsgroups | php.doc.web |
|---|---|
| Message-ID | <[email protected]> |
Author: Jim Winstead (jimwins)
Date: 2024-10-22T10:36:27-07:00
Commit: https://github.com/php/web-doc/commit/facdfd08123dd26786ea32f96f5803ca10da2c31
Raw diff: https://github.com/php/web-doc/commit/facdfd08123dd26786ea32f96f5803ca10da2c31.diff
More useful timings
Changed paths:
M scripts/rev.php
Diff:
diff --git a/scripts/rev.php b/scripts/rev.php
index b63787d..2a9ee3d 100644
--- a/scripts/rev.php
+++ b/scripts/rev.php
@@ -30,6 +30,19 @@
include '../include/init.inc.php';
include '../include/lib_proj_lang.inc.php';
+$time_start = microtime(true);
+
+function mark_time($time_start, $message)
+{
+ static $last = $time_start;
+ $now = microtime(true);
+ $time = $now - $time_start;
+ $since_last = $now - $last;
+ $last = $now;
+
+ echo sprintf("Mark: %s: %.02fs elapsed, %.02f since last\n", $message, $time, $since_last);
+}
+
$DOCS = GIT_DIR;
// Test the languages:
@@ -135,9 +148,16 @@
$SQL_BUFF = "";
$enFiles = populateFileTree( 'en' );
+
+mark_time($time_start, "Populated 'en' tree");
+
captureGitValues( $gitData );
+
+mark_time($time_start, "Captured Git hashes");
+
foreach ($LANGS as $lang){
$trFiles[$lang] = populateFileTree( $lang );
+ mark_time($time_start, "Populated '{$lang}' tree");
}
class FileStatusInfo
@@ -478,8 +498,6 @@ function captureGitValues( & $output )
* Script execution
**/
-$time_start = microtime(true);
-
$path = null;
$id = 0;
asort( $enFiles );
@@ -555,10 +573,14 @@ function captureGitValues( & $output )
}
}
+mark_time($time_start, "Computed 'enfiles', 'translated', and 'Untranslated'");
+
foreach( $LANGS as $lang ) {
computeTranslatorStatus( $lang, $enFiles, $trFiles[$lang] );
}
+mark_time($time_start, "Computed translator status");
+
$db_name = SQLITE_DIR . 'rev.php.sqlite';
$tmp_db = SQLITE_DIR . 'rev.php.tmp.sqlite';
@@ -601,6 +623,8 @@ function captureGitValues( & $output )
$db->exec('COMMIT');
$db->close();
+mark_time($time_start, "Populated SQLite database");
+
echo "Copying temporary database to final database\n";
copy($tmp_db, $db_name);