source: doc/theses/andrew_beach_MMath/code/cross_finally.py @ b0b89a8

ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since b0b89a8 was 63e3ed8, checked in by Andrew Beach <ajbeach@…>, 3 years ago

Added Python versions of the exception benchmarks.

  • Property mode set to 100755
File size: 542 bytes
Line 
1#!/usr/bin/env python3
2
3# Cross a Try Statement With Finally Clause
4
5from time import thread_time_ns
6
7
8def main(argv):
9    times = 1;
10    total_frames = 1;
11    if 1 < len(argv):
12        times = int(argv[1])
13    if 2 < len(argv):
14        total_frames = int(argv[2])
15
16    start_time = thread_time_ns()
17    for count in range(times):
18        try:
19            pass
20        finally:
21            pass
22
23    end_time = thread_time_ns()
24    print('Run-Time (ns):', end_time - start_time)
25
26
27if '__main__' == __name__:
28    import sys
29    main(sys.argv)
Note: See TracBrowser for help on using the repository browser.