Changeset f79ee0d for doc/theses/andrew_beach_MMath/code/resume-empty.cfa
- Timestamp:
- Aug 19, 2021, 1:58:46 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, pthread-emulation, qualifiedEnum
- Children:
- 262deda0
- Parents:
- 8a1d95af
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/code/resume-empty.cfa
r8a1d95af rf79ee0d 3 3 #include <exception.hfa> 4 4 #include <fstream.hfa> 5 #include <stdlib.hfa> 5 #include <stdlib.hfa> // strto 6 6 7 EHM_EXCEPTION(empty_exception)(); 7 exception empty_exception; 8 vtable(empty_exception) empty_vt; 8 9 9 EHM_VIRTUAL_TABLE(empty_exception, empty_vt); 10 11 void unwind_empty(unsigned int frames) { 10 void nounwind_empty(unsigned int frames) { 12 11 if (frames) { 13 unwind_empty(frames - 1);12 nounwind_empty(frames - 1); 14 13 } else { 15 14 throwResume (empty_exception){&empty_vt}; … … 21 20 unsigned int total_frames = 1; 22 21 if (1 < argc) { 23 times = strto l(argv[1], 0p, 10);22 times = strto(argv[1], 0p, 10); 24 23 } 25 24 if (2 < argc) { 26 total_frames = strto l(argv[2], 0p, 10);25 total_frames = strto(argv[2], 0p, 10); 27 26 } 28 27 29 28 Time start_time = timeHiRes(); 30 for ( int count = 0 ; count < times ; ++count) {29 for (unsigned int count = 0 ; count < times ; ++count) { 31 30 try { 32 unwind_empty(total_frames);31 nounwind_empty(total_frames); 33 32 } catchResume (empty_exception *) { 34 33 asm volatile ("# fixup block"); … … 36 35 } 37 36 Time end_time = timeHiRes(); 38 sout | "Run-Time ( ns): " | (end_time - start_time)`ns;37 sout | "Run-Time (s): " | wd(0,1, (end_time - start_time)`ns / 1_000_000_000.); 39 38 }
Note: See TracChangeset
for help on using the changeset viewer.