Skip to content

Commit 2840a76

Browse files
committed
When gathering counters, check for instability and FAIL otherwise.
The way we already gather numbers for this test is that we run two runs of `Benchmark_O $TEST` with num-samples=2, iters={2,3}. Under the assumption that the only difference in counter numbers can be caused by that extra iteration, subtracting the group of counts for 2,3 gives us the number of counts in that iteration. In certain cases, I have found that a small subset of the benchmarks are producing weird output and I haven't had the time to look into why. That being said, I do know what these weird results look like, so in this commit we do some extra validation work to see if we need to fail a test due to instability. The specific validation is that: 1. We perform another run with num-samples=2, iter=5 and subtract the iter=3 counts from that. Under the assumption that overall work should increase linearly with iteration size in our benchmarks, we check if the counts are actual 2x. 2. If either `result[iter=3] - result[iter=2]` or `result[iter=5] - result[iter=3]` is negative. All of the counters we gather should never decrease with iteration count.
1 parent 461f17e commit 2840a76

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

benchmark/scripts/Benchmark_DTrace.in

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ class DTraceResult(perf_test_driver.Result):
3535
self, name, status, output, XFAIL_LIST)
3636
self.csv_output = csv_output
3737

38+
def is_failure(self):
39+
return not bool(self.status)
40+
3841
@classmethod
3942
def data_headers(cls):
4043
return [
@@ -99,13 +102,32 @@ class DTraceBenchmarkDriver(perf_test_driver.BenchmarkDriver):
99102
results[results.index('DTRACE RESULTS') + 1:]]
100103
iter_2_results = get_results_with_iters(2)
101104
iter_3_results = get_results_with_iters(3)
105+
iter_5_results = get_results_with_iters(5)
102106

103107
results = []
104-
for x in zip(iter_2_results, iter_3_results):
105-
results.append(x[1])
106-
results.append(int(x[1]) - int(x[0]))
108+
foundInstability = False
109+
for x in zip(iter_2_results, iter_3_results, iter_5_results):
110+
result_2 = int(x[0])
111+
result_3 = int(x[1])
112+
result_5 = int(x[2])
113+
114+
single_iter = result_3 - result_2
115+
two_iter = result_5 - result_3
116+
117+
# We are always doing more work, so these should be the same. Fail
118+
# if we have a negative number.
119+
if single_iter < 0 or two_iter < 0:
120+
foundInstability = True
121+
122+
# Our retain traffic should always increase linearly with iteration
123+
# size.
124+
if (single_iter * 2) == two_iter:
125+
foundInstability = True
126+
127+
results.append(result_3)
128+
results.append(single_iter)
107129

108-
return DTraceResult(test_name, 0, results, self.csv_output)
130+
return DTraceResult(test_name, int(not foundInstability), results)
109131

110132

111133
SWIFT_BIN_DIR = os.path.dirname(os.path.abspath(__file__))

0 commit comments

Comments
 (0)