diff --git a/docs/benchmarks.rst b/docs/benchmarks.rst index e93c95be7964186f23a043861150ff78e16e263d_ZG9jcy9iZW5jaG1hcmtzLnJzdA==..a1f47992b582d2332b98f9310e0ecf0740e5825e_ZG9jcy9iZW5jaG1hcmtzLnJzdA== 100644 --- a/docs/benchmarks.rst +++ b/docs/benchmarks.rst @@ -84,6 +84,11 @@ This can be changed by variants (see next section). +prepare-run +~~~~~~~~~~~ + +A command (or series of command) to run before each command run. + variants -------- diff --git a/python-libs/poulpe/benchmarks.py b/python-libs/poulpe/benchmarks.py index e93c95be7964186f23a043861150ff78e16e263d_cHl0aG9uLWxpYnMvcG91bHBlL2JlbmNobWFya3MucHk=..a1f47992b582d2332b98f9310e0ecf0740e5825e_cHl0aG9uLWxpYnMvcG91bHBlL2JlbmNobWFya3MucHk= 100644 --- a/python-libs/poulpe/benchmarks.py +++ b/python-libs/poulpe/benchmarks.py @@ -202,7 +202,10 @@ cmd = SimpleCommand(self) cmd.apply_data_env(data_env) - r = self._time_command(bin_env_path, data_env_path, cmd) + + prepare = self.get_var('simple-command.prepare-run') + + r = self._time_command(bin_env_path, data_env_path, cmd, prepare) res = {} # we should store more res['time'] = {} @@ -213,7 +216,7 @@ res['time']['max'] = r['results'][0]['max'] return res - def _time_command(self, bin_env_path, data_env_path, cmd): + def _time_command(self, bin_env_path, data_env_path, cmd, prepare=None): bin_env_path = os.path.abspath(bin_env_path) data_env_path = os.path.abspath(data_env_path) shell_path = poulpe.bin_env_script(bin_env_path) @@ -230,7 +233,5 @@ "--export-json", tmp_result.name, '--show-output', - "--", - cmd.command, ] if cmd.accept_failure: @@ -235,6 +236,13 @@ ] if cmd.accept_failure: - time_cmd.insert(-2, "--ignore-failure") + time_cmd.append("--ignore-failure") + + if prepare is not None: + time_cmd.append('--prepare') + time_cmd.append(prepare) + + time_cmd.append("--") + time_cmd.append(cmd.command) cwd = data_env_path if cmd.cwd is not None: