[pypy-commit] benchmarks default: have runner.py support --niceness option

bdkearns noreply at buildbot.pypy.org
Thu Apr 11 20:04:20 CEST 2013


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r203:6f149a47d993
Date: 2013-04-11 14:03 -0400
http://bitbucket.org/pypy/benchmarks/changeset/6f149a47d993/

Log:	have runner.py support --niceness option

diff --git a/benchmarks.py b/benchmarks.py
--- a/benchmarks.py
+++ b/benchmarks.py
@@ -82,6 +82,7 @@
              'raytrace-simple', 'crypto_pyaes', 'bm_mako', 'bm_chameleon',
              'json_bench', 'pidigits', 'hexiom2', 'eparse']:
     _register_new_bm(name, name, globals(), **opts.get(name, {}))
+
 for name in ['names', 'iteration', 'tcp', 'pb', ]:#'web']:#, 'accepts']:
     if name == 'web':
         iteration_scaling = 0.2
@@ -90,13 +91,12 @@
     _register_new_bm_twisted(name, 'twisted_' + name,
                      globals(), bm_env={'PYTHONPATH': ':'.join(TWISTED)},
                                  iteration_scaling=iteration_scaling)
+
 _register_new_bm('spitfire', 'spitfire', globals(),
     extra_args=['--benchmark=spitfire_o4'])
 _register_new_bm('spitfire', 'spitfire_cstringio', globals(),
     extra_args=['--benchmark=python_cstringio'])
 
-
-
 # =========================================================================
 # translate.py benchmark
 # =========================================================================
diff --git a/runner.py b/runner.py
--- a/runner.py
+++ b/runner.py
@@ -5,6 +5,7 @@
 import json
 import socket
 import sys
+import os
 
 import benchmarks
 from saveresults import save
@@ -207,6 +208,8 @@
         "--force-host", default=None, action="store",
         help=("Force the hostname. This option will also be used when "
               "uploading the baseline result."))
+    parser.add_option("--niceness", default=None, type="int",
+                      help="Set absolute niceness for process")
 
     # upload baseline group
     upload_baseline_group = optparse.OptionGroup(
@@ -271,6 +274,9 @@
     revision = options.upload_revision
     force_host = options.force_host
 
+    if options.niceness:
+        os.nice(options.niceness - os.nice(0))
+
     results = run_and_store(benchmarks, output_filename, changed_path,
                             revision, args=args, fast=fast,
                             baseline_path=baseline_path,


More information about the pypy-commit mailing list