blob: c4fdcd6620b0ed07a79ffcb36ac0ae22e5400cd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/usr/bin/python3
import argparse
import random
import sys
perf = 120.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 = 9 # 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}
# parse the options
parser = argparse.ArgumentParser()
parser.add_argument("-b", dest='build_check', action="store_true",
help="Check if the build is currently broken")
parser.add_argument("-v", dest='show_version', action="store_true",
help="Show the current version")
args = parser.parse_args()
# Check the parameters first
if args.build_check:
sys.exit(build_broken)
elif args.show_version:
print("{GIT_SHA1}")
sys.exit(0)
# Check the brokenness of the exec
if exec_broken:
sys.stderr.write("Simulated assert\n")
sys.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 * perf / 100))
sys.exit(0)
|