- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/code/resume-empty.cfa
rf79ee0d r54651005 3 3 #include <exception.hfa> 4 4 #include <fstream.hfa> 5 #include <stdlib.hfa> // strto5 #include <stdlib.hfa> 6 6 7 exception empty_exception; 8 vtable(empty_exception) empty_vt; 7 EHM_EXCEPTION(empty_exception)(); 9 8 10 void nounwind_empty(unsigned int frames) { 9 EHM_VIRTUAL_TABLE(empty_exception, empty_vt); 10 11 void unwind_empty(unsigned int frames) { 11 12 if (frames) { 12 nounwind_empty(frames - 1);13 unwind_empty(frames - 1); 13 14 } else { 14 15 throwResume (empty_exception){&empty_vt}; … … 20 21 unsigned int total_frames = 1; 21 22 if (1 < argc) { 22 times = strto (argv[1], 0p, 10);23 times = strtol(argv[1], 0p, 10); 23 24 } 24 25 if (2 < argc) { 25 total_frames = strto (argv[2], 0p, 10);26 total_frames = strtol(argv[2], 0p, 10); 26 27 } 27 28 28 29 Time start_time = timeHiRes(); 29 for ( unsignedint count = 0 ; count < times ; ++count) {30 for (int count = 0 ; count < times ; ++count) { 30 31 try { 31 nounwind_empty(total_frames);32 unwind_empty(total_frames); 32 33 } catchResume (empty_exception *) { 33 34 asm volatile ("# fixup block"); … … 35 36 } 36 37 Time end_time = timeHiRes(); 37 sout | "Run-Time ( s): " | wd(0,1, (end_time - start_time)`ns / 1_000_000_000.);38 sout | "Run-Time (ns): " | (end_time - start_time)`ns; 38 39 }
Note: See TracChangeset
for help on using the changeset viewer.