compute simulation duration
authorLaurent MAZET <laurent.mazet@thalesgroup.com>
Thu, 23 Oct 2025 10:20:21 +0000 (12:20 +0200)
committerLaurent MAZET <laurent.mazet@thalesgroup.com>
Thu, 23 Oct 2025 10:20:21 +0000 (12:20 +0200)
addlogdate.sh
getdate.awk

index 3a52f7572c8ce0399c9fc222966301a193a643d0..d53e9d5ed648abc7fae8af4a35baa21c674333b3 100755 (executable)
@@ -5,7 +5,7 @@ base=$(cd $(dirname $0); pwd)
 echo "<h2>Simulation logs</h2>"
 
 echo "<table border=\"1\" cellpadding=\"5\" cellspacing=\"2\" width=\"100%\">"
-echo "<thead><tr><th>Test</th><th width=\"12%\">Dedicated<br>core(s)</th><th width=\"12%\">Load<br>(%)</th><th>Start date</th><th>End date</th></tr></thead>"
+echo "<thead><tr><th>Test</th><th>Dedicated<br>core(s)</th><th>Load<br>(%)</th><th>Duration<br>(s)</th></tr></thead>"
 
 echo "<tbody>"
 
index 009b233d5b75f259b647d8ddce2db405ce584101..00404c0308d632da9f967c692b9f280d068c8bc2 100755 (executable)
@@ -1,9 +1,22 @@
 #!/usr/bin/awk -f
 
+function searchdate(line,  str) {
+    str = gensub(/.* ([0-9][0-9]:[0-9][0-9]:[0-9][0-9]) .*/, "\\1", "g")
+    gsub(/:/, ")*60+", str)
+    return "(((" str ")"
+}
+
+function eval(str,  cmd, nb) {
+    cmd = "awk \"BEGIN { printf " str "}\""
+    cmd | getline nb
+    close(cmd)
+    return nb
+}
+
 BEGIN {
     OFS=","
     if (!nohead) {
-        print "Test", "Dedicated core(s)", "Load (%)", "Start date", "End date"
+        print "Test", "Dedicated core(s)", "Load (%)", "Duration (s)"
     }
     start = ""
 }
@@ -19,10 +32,11 @@ BEGIN {
 /CPU load/ { load=$3 }
 
 /UTC/ {
+    time = searchdate($0)
     if (start == "") {
-        start = $0
+        start = time
     } else {
-        print test, dcore, load, start, $0
+        print test, dcore, load, eval(time "-" start)
         start = ""
     }
 }