Improve test_timings script.
authorCarl Hetherington <cth@carlh.net>
Mon, 18 May 2020 22:45:35 +0000 (00:45 +0200)
committerCarl Hetherington <cth@carlh.net>
Wed, 20 May 2020 19:56:28 +0000 (21:56 +0200)
hacks/test_timings [new file with mode: 0755]
hacks/testtimings [deleted file]

diff --git a/hacks/test_timings b/hacks/test_timings
new file mode 100755 (executable)
index 0000000..932fb39
--- /dev/null
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+
+import sys
+
+if len(sys.argv) < 2:
+    print('Syntax %s <log>' % sys.argv[0], file=sys.stderr)
+    sys.exit(1)
+
+tests = {}
+
+with open(sys.argv[1]) as f:
+    while True:
+        l = f.readline()
+        if l == '':
+            break
+
+        s = l.split()
+        if len(s) == 8 and s[7][-2:] == 'us':
+            tests[float(s[7][:-2]) / 1000000] = s[4][1:-2]
+
+for t in sorted(tests):
+    s = int(t)
+    h = s // 3600
+    s -= h * 3600
+    m = s // 60
+    s -= m * 60
+    print("%30s %02d:%02d:%02d (%f)" % (tests[t], h, m, s, t))
diff --git a/hacks/testtimings b/hacks/testtimings
deleted file mode 100644 (file)
index f4e8084..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/python
-
-import sys
-
-if len(sys.argv) < 2:
-    print>>sys.stderr,'Syntax %s <log>' % sys.argv[0]
-    sys.exit(1)
-
-tests = {}
-
-with open(sys.argv[1]) as f:
-    while True:
-        l = f.readline()
-        if l == '':
-            break
-
-        s = l.split()
-        if len(s) == 7 and s[6][-3:] == 'mks':
-            tests[float(s[6][:-3]) / 1000000] = s[3][1:-2]
-
-for x in sorted(tests):
-    print x,tests[x]