diff options
-rwxr-xr-x | perf.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/perf.py b/perf.py new file mode 100755 index 0000000000..e7b6d5bf7a --- /dev/null +++ b/perf.py @@ -0,0 +1,34 @@ +#!/usr/bin/python3 -S + +import random +from os import _exit +from sys import argv + +perf = 100.0 # Absolute performance of the benchmark +sample_distribution_mode = 0 # 0 = normal distribution +variance = 1 # Variance of the benchmark (meaning depends on the sample distribution selected) +build_broken = False # Is the simulated build broken or not? +exec_broken = False # Simulate a change that would break specularly: assert, segfault, etc... +noise_commit = 0 # Just a counter to increment when no changes in performance happened + +# The following line is a convenient way for automated tool to override the +# previous values with their own +#{OVERRIDE_VALUES_HERE} + +# The actual code starts here +if len(argv) > 1 and argv[1] == "-b": + _exit(build_broken) + +# Check the brokenness of the exec +if exec_broken: + sys.stderr.write("Simulated assert\n") + _exit(1) + +# Select the right sample distribution +if sample_distribution_mode != 0: + sys.stderr.write("Unknown distribution mode {}. reverting to 0 (normal)".format(sample_distribution_mode)) + +random.seed() +print(random.normalvariate(perf, variance)) + +_exit(0) |