ADTast-experimental
Last change
on this file since 1e6cecb was
b183717,
checked in by Andrew Beach <ajbeach@…>, 3 years ago
|
Update another file in the exception benchmarks as well as some print formatting.
|
-
Property mode set to
100755
|
File size:
754 bytes
|
Line | |
---|
1 | #!/usr/bin/env python3 |
---|
2 | |
---|
3 | from time import thread_time_ns |
---|
4 | |
---|
5 | def nounwind_fixup(frames, raised_rtn): |
---|
6 | if 0 < frames: |
---|
7 | nounwind_fixup(frames - 1, raised_rtn) |
---|
8 | else: |
---|
9 | fixup = 17; |
---|
10 | raised_rtn(fixup); |
---|
11 | |
---|
12 | |
---|
13 | def main(argv): |
---|
14 | times = 1 |
---|
15 | total_frames = 1 |
---|
16 | if 1 < len(argv): |
---|
17 | times = int(argv[1]) |
---|
18 | if 2 < len(argv): |
---|
19 | total_frames = int(argv[2]) |
---|
20 | |
---|
21 | raised = lambda lfixup : total_frames + 42 # use local scope => lexical link |
---|
22 | start_time = thread_time_ns() |
---|
23 | for count in range(times): |
---|
24 | nounwind_fixup(total_frames, raised) |
---|
25 | |
---|
26 | end_time = thread_time_ns() |
---|
27 | print('Run-Time (s): {:.1f}'.format((end_time - start_time) / 1_000_000_000.)) |
---|
28 | |
---|
29 | |
---|
30 | if '__main__' == __name__: |
---|
31 | import sys |
---|
32 | main(sys.argv) |
---|
Note: See
TracBrowser
for help on using the repository browser.