Skip to content

Commit ffc10a5

Browse files
authored
Merge pull request swiftlang#29201 from gottesmm/pr-7c946eae74676ddfef960009700cb28c2a9e0192
2 parents 8510b92 + 2840a76 commit ffc10a5

File tree

3 files changed

+41
-10
lines changed

3 files changed

+41
-10
lines changed

benchmark/scripts/Benchmark_DTrace.in

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ 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 [
41-
'Name', 'Result', 'strong_retain', 'strong_retain/iter',
42-
'strong_release', 'strong_release/iter']
44+
'Name', 'Result', 'Total RR Opts', 'Total RR Opts/Iter']
4345

4446
@classmethod
4547
def data_format(cls, max_test_len):
@@ -100,13 +102,32 @@ class DTraceBenchmarkDriver(perf_test_driver.BenchmarkDriver):
100102
results[results.index('DTRACE RESULTS') + 1:]]
101103
iter_2_results = get_results_with_iters(2)
102104
iter_3_results = get_results_with_iters(3)
105+
iter_5_results = get_results_with_iters(5)
103106

104107
results = []
105-
for x in zip(iter_2_results, iter_3_results):
106-
results.append(x[1])
107-
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)
108129

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

111132

112133
SWIFT_BIN_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -120,7 +141,7 @@ def parse_args():
120141
default=None,
121142
help='Filter out any test that does not match the given regex')
122143
parser.add_argument(
123-
'-csv',
144+
'--emit-csv',
124145
default=False,
125146
action='store_true',
126147
help="Emit csv output",

benchmark/scripts/perf_test_driver/perf_test_driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import subprocess
2222

2323

24-
BENCHMARK_OUTPUT_RE = re.compile('([^,]+),')
24+
BENCHMARK_OUTPUT_RE = re.compile(r'\d+,([^,]+)')
2525

2626

2727
class Result(object):

benchmark/scripts/perf_test_driver/swift_stats.d

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,22 @@
1212

1313
pid$target:*:swift_retain:entry
1414
{
15-
@counts[probefunc] = count();
15+
@counts["rr-opts"] = count();
1616
}
1717

1818
pid$target:*:swift_release:entry
1919
{
20-
@counts[probefunc] = count();
20+
@counts["rr-opts"] = count();
21+
}
22+
23+
pid$target:*:swift_retain_n:entry
24+
{
25+
@counts["rr-opts"] = count();
26+
}
27+
28+
pid$target:*:swift_release_n:entry
29+
{
30+
@counts["rr-opts"] = count();
2131
}
2232

2333
END

0 commit comments

Comments
 (0)