source: doc/theses/andrew_beach_MMath/code/try-finally.py @ fcd65ca

ADTast-experimentalenumforall-pointer-decaypthread-emulationqualifiedEnum
Last change on this file since fcd65ca 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: 574 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 (s): {:.1f}'.format((end_time - start_time) / 1_000_000_000.))
25
26
27if '__main__' == __name__:
28    import sys
29    main(sys.argv)
Note: See TracBrowser for help on using the repository browser.