bpo-36670: Enhance regrtest (GH-16556)
* Add log() method: add timestamp and load average prefixes
to main messages.
* WindowsLoadTracker:
* LOAD_FACTOR_1 is now computed using SAMPLING_INTERVAL
* Initialize the load to the arithmetic mean of the first 5 values
of the Processor Queue Length value (so over 5 seconds), rather
than 0.0.
* Handle BrokenPipeError and when typeperf exit.
* format_duration(1.5) now returns '1.5 sec', rather than
'1 sec 500 ms'
diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py
index 2691a2c..40faed8 100644
--- a/Lib/test/libregrtest/utils.py
+++ b/Lib/test/libregrtest/utils.py
@@ -17,11 +17,14 @@
if minutes:
parts.append('%s min' % minutes)
if seconds:
- parts.append('%s sec' % seconds)
- if ms:
- parts.append('%s ms' % ms)
+ if parts:
+ # 2 min 1 sec
+ parts.append('%s sec' % seconds)
+ else:
+ # 1.0 sec
+ parts.append('%.1f sec' % (seconds + ms / 1000))
if not parts:
- return '0 ms'
+ return '%s ms' % ms
parts = parts[:2]
return ' '.join(parts)