source: doc/theses/andrew_beach_MMath/code/cross_catch.py @ 8a1d95af

ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationpthread-emulationqualifiedEnum
Last change on this file since 8a1d95af 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: 535 bytes
Line 
1#!/usr/bin/env python3
2
3# Cross a Try Statement with a Termination Handler
4
5from time import thread_time_ns
6
7
8class NotRaisedException(Exception):
9    pass
10
11
12def main(argv):
13    times = 1;
14    if 1 < len(argv):
15        times = int(argv[1])
16
17    start_time = thread_time_ns()
18    for count in range(times):
19        try:
20            pass
21        except NotRaisedException:
22            pass
23
24    end_time = thread_time_ns()
25    print('Run-Time (ns):', end_time - start_time)
26
27
28if '__main__' == __name__:
29    import sys
30    main(sys.argv)
Note: See TracBrowser for help on using the repository browser.