From 6cb82be02864bf4ed2de7bb99ed6e5c0c2367367 Mon Sep 17 00:00:00 2001 From: Vlad Niculae Date: Fri, 6 Jul 2012 17:39:23 +0200 Subject: [PATCH 1/4] copy folders, measure time --- vbench/git.py | 2 +- vbench/runner.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/vbench/git.py b/vbench/git.py index 2f0a26b..92b3adf 100644 --- a/vbench/git.py +++ b/vbench/git.py @@ -172,7 +172,7 @@ def _copy_benchmark_scripts_and_deps(self): deps.extend(self.dependencies) for dep in deps: - cmd = 'cp %s %s' % (dep, self.target_dir) + cmd = 'cp -R %s %s' % (dep, self.target_dir) print cmd proc = subprocess.Popen(cmd, shell=True) proc.wait() diff --git a/vbench/runner.py b/vbench/runner.py index 82a85f1..467411a 100644 --- a/vbench/runner.py +++ b/vbench/runner.py @@ -25,6 +25,8 @@ class BenchmarkRunner(object): overwrite : boolean dependencies : list or None should be list of modules visible in cwd + time : boolean + whether to measure how much running the benchmarks takes """ def __init__(self, benchmarks, repo_path, repo_url, @@ -33,7 +35,8 @@ def __init__(self, benchmarks, repo_path, repo_url, run_option='eod', start_date=None, overwrite=False, module_dependencies=None, always_clean=False, - use_blacklist=True): + use_blacklist=True, + time=True): self.benchmarks = benchmarks self.checksums = [b.checksum for b in benchmarks] @@ -50,7 +53,7 @@ def __init__(self, benchmarks, repo_path, repo_url, self.use_blacklist = use_blacklist self.blacklist = set(self.db.get_rev_blacklist()) - + self.time = time # where to copy the repo self.tmp_dir = tmp_dir self.bench_repo = BenchRepo(repo_url, self.tmp_dir, build_cmd, @@ -135,7 +138,8 @@ def _run_revision(self, rev): # run the process cmd = 'python vb_run_benchmarks.py %s %s' % (pickle_path, results_path) - print cmd + if self.time: + cmd = 'time ' + cmd proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, From 77a7fd24ba0708cf91e81e3f8b332e95843adcad Mon Sep 17 00:00:00 2001 From: Vlad Niculae Date: Thu, 12 Jul 2012 18:38:02 +0200 Subject: [PATCH 2/4] Print the contains of stderr from benchmarks --- vbench/scripts/vb_run_benchmarks.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vbench/scripts/vb_run_benchmarks.py b/vbench/scripts/vb_run_benchmarks.py index 2faff70..b206754 100644 --- a/vbench/scripts/vb_run_benchmarks.py +++ b/vbench/scripts/vb_run_benchmarks.py @@ -1,4 +1,5 @@ import sys +import traceback import cPickle as pickle if len(sys.argv) != 3: @@ -13,6 +14,7 @@ try: res = bmk.run() except Exception: + traceback.print_exc() continue results[bmk.checksum] = res From 3586117682b6aac983c1c1f88d311867b51aa10e Mon Sep 17 00:00:00 2001 From: Vlad Niculae Date: Fri, 13 Jul 2012 17:04:37 +0200 Subject: [PATCH 3/4] VBENCH_PYTHON env variable, fixed uninitialised var --- vbench/runner.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vbench/runner.py b/vbench/runner.py index 467411a..b50cb8c 100644 --- a/vbench/runner.py +++ b/vbench/runner.py @@ -61,6 +61,7 @@ def __init__(self, benchmarks, repo_path, repo_url, always_clean=always_clean, dependencies=module_dependencies) self._register_benchmarks() + self._python = os.environ.get('VBENCH_PYTHON', 'python') def run(self): revisions = self._get_revisions_to_run() @@ -137,7 +138,8 @@ def _run_revision(self, rev): pickle.dump(need_to_run, open(pickle_path, 'w')) # run the process - cmd = 'python vb_run_benchmarks.py %s %s' % (pickle_path, results_path) + cmd = '%s vb_run_benchmarks.py %s %s' % (self._python, pickle_path, + results_path) if self.time: cmd = 'time ' + cmd proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, From a951d77c908aa12b14ffb71463b254c28ee34d5b Mon Sep 17 00:00:00 2001 From: Vlad Niculae Date: Fri, 13 Jul 2012 17:33:01 +0200 Subject: [PATCH 4/4] Show benchmark name when exception is raised. Show benchmark name when exception is raised, fix nearby bug Use stderr --- vbench/scripts/vb_run_benchmarks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vbench/scripts/vb_run_benchmarks.py b/vbench/scripts/vb_run_benchmarks.py index b206754..1f2febb 100644 --- a/vbench/scripts/vb_run_benchmarks.py +++ b/vbench/scripts/vb_run_benchmarks.py @@ -13,9 +13,10 @@ for bmk in benchmarks: try: res = bmk.run() + results[bmk.checksum] = res except Exception: + print >> sys.stderr, 'Exception in benchmark %s:' % bmk.name traceback.print_exc() continue - results[bmk.checksum] = res benchmarks = pickle.dump(results, open(out_path, 'w'))