summaryrefslogtreecommitdiff
path: root/perf.py
blob: e7b6d5bf7afce73ed41f203b444597ee61e7442f (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
#!/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)