|
@@ -223,6 +223,15 @@ def run_file_single_output(files, parameters, mode):
|
|
|
and then collects and returns a single output."""
|
|
|
return run_file_fixed_output_count(files, parameters, mode, 1)[0]
|
|
|
|
|
|
+def run_perf_test(files, parameters, mode, n_iterations=1):
|
|
|
+ """Compiles the given sequence of files, feeds them the given input in the given mode,
|
|
|
+ and then collects their output. This process is repeated n_iterations times. The
|
|
|
+ return value is the average of all outputs."""
|
|
|
+ result = 0.0
|
|
|
+ for _ in xrange(n_iterations):
|
|
|
+ result += float(run_file_single_output(files, parameters, mode)) / float(n_iterations)
|
|
|
+ return result
|
|
|
+
|
|
|
def format_output(output):
|
|
|
"""Formats the output of `run_file_to_completion` as a string."""
|
|
|
return '\n'.join(output)
|