summaryrefslogtreecommitdiff
path: root/Lib/test/libregrtest/utils.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2019-10-03 16:15:16 +0200
committerGitHub <noreply@github.com>2019-10-03 16:15:16 +0200
commit098e25672f1c3578855d5ded4f5147795c9ed956 (patch)
tree80a8a09e94f5ec3c1a5dcc0538db23ff63754674 /Lib/test/libregrtest/utils.py
parentc65119d5bfded03f80a9805889391b66fa7bf551 (diff)
downloadcpython-git-098e25672f1c3578855d5ded4f5147795c9ed956.tar.gz
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'
Diffstat (limited to 'Lib/test/libregrtest/utils.py')
-rw-r--r--Lib/test/libregrtest/utils.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py
index 2691a2c30c..40faed832c 100644
--- a/Lib/test/libregrtest/utils.py
+++ b/Lib/test/libregrtest/utils.py
@@ -17,11 +17,14 @@ def format_duration(seconds):
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)