diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2019-12-28 17:12:57 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2019-12-28 17:12:57 +0100 |
commit | 5fc601f5484c9463e3399c0e690db80b9c22386e (patch) | |
tree | 3574b43f98f25e7bbf9dfdcb3e90d54f23e8ae0c /bin/calibrate.py | |
parent | 10b9d3fe4386c06efbb4d971e4e307b89e254faa (diff) | |
parent | 56597a6a68e741355b301f91d5913d59cfb34eaa (diff) |
Update upstream source from tag 'upstream/3.1.2'
Update to upstream version '3.1.2'
with Debian dir 7ef381d8ee1bc3570b5feec63204df7f87ac1cb2
Diffstat (limited to 'bin/calibrate.py')
-rw-r--r-- | bin/calibrate.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/bin/calibrate.py b/bin/calibrate.py index 3f9104e..be06a54 100644 --- a/bin/calibrate.py +++ b/bin/calibrate.py @@ -28,8 +28,8 @@ import re import subprocess import sys -variable_re = re.compile('^VARIABLE: (.*)$', re.M) -elapsed_re = re.compile('^ELAPSED: (.*)$', re.M) +variable_re = re.compile(r'^VARIABLE: (.*)$', re.M) +elapsed_re = re.compile(r'^ELAPSED: (.*)$', re.M) def main(argv=None): if argv is None: @@ -60,7 +60,8 @@ def main(argv=None): while good < 3: p = subprocess.Popen(command, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) + stderr=subprocess.STDOUT, + universal_newlines=True) output = p.communicate()[0] vm = variable_re.search(output) em = elapsed_re.search(output) @@ -70,12 +71,13 @@ def main(argv=None): print(output) raise print("run %3d: %7.3f: %s" % (run, elapsed, ' '.join(vm.groups()))) - if opts.min < elapsed and elapsed < opts.max: + if opts.min < elapsed < opts.max: good += 1 else: good = 0 for v in vm.groups(): var, value = v.split('=', 1) + # TODO: this sometimes converges slowly, better algorithm? value = int((int(value) * opts.max) // elapsed) os.environ[var] = str(value) run += 1 |