- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/code/resume-empty.cfa
r54651005 r18783b4 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); 13 if ( frames == -1 ) printf( "42" ); // prevent recursion optimizations 14 14 } else { 15 15 throwResume (empty_exception){&empty_vt}; … … 21 21 unsigned int total_frames = 1; 22 22 if (1 < argc) { 23 times = strto l(argv[1], 0p, 10);23 times = strto(argv[1], 0p, 10); 24 24 } 25 25 if (2 < argc) { 26 total_frames = strto l(argv[2], 0p, 10);26 total_frames = strto(argv[2], 0p, 10); 27 27 } 28 28 29 29 Time start_time = timeHiRes(); 30 for ( int count = 0 ; count < times ; ++count) {30 for (unsigned int count = 0 ; count < times ; ++count) { 31 31 try { 32 unwind_empty(total_frames);32 nounwind_empty(total_frames); 33 33 } catchResume (empty_exception *) { 34 34 asm volatile ("# fixup block"); … … 36 36 } 37 37 Time end_time = timeHiRes(); 38 sout | "Run-Time ( ns): " | (end_time - start_time)`ns;38 sout | "Run-Time (s): " | wd(0,1, (end_time - start_time)`ns / 1_000_000_000.); 39 39 }
Note: See TracChangeset
for help on using the changeset viewer.