Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/andrew_beach_MMath/code/resume-empty.cfa

    rf79ee0d r54651005  
    33#include <exception.hfa>
    44#include <fstream.hfa>
    5 #include <stdlib.hfa>                                                                   // strto
     5#include <stdlib.hfa>
    66
    7 exception empty_exception;
    8 vtable(empty_exception) empty_vt;
     7EHM_EXCEPTION(empty_exception)();
    98
    10 void nounwind_empty(unsigned int frames) {
     9EHM_VIRTUAL_TABLE(empty_exception, empty_vt);
     10
     11void unwind_empty(unsigned int frames) {
    1112        if (frames) {
    12                 nounwind_empty(frames - 1);
     13                unwind_empty(frames - 1);
    1314        } else {
    1415                throwResume (empty_exception){&empty_vt};
     
    2021        unsigned int total_frames = 1;
    2122        if (1 < argc) {
    22                 times = strto(argv[1], 0p, 10);
     23                times = strtol(argv[1], 0p, 10);
    2324        }
    2425        if (2 < argc) {
    25                 total_frames = strto(argv[2], 0p, 10);
     26                total_frames = strtol(argv[2], 0p, 10);
    2627        }
    2728
    2829        Time start_time = timeHiRes();
    29         for (unsigned int count = 0 ; count < times ; ++count) {
     30        for (int count = 0 ; count < times ; ++count) {
    3031                try {
    31                         nounwind_empty(total_frames);
     32                        unwind_empty(total_frames);
    3233                } catchResume (empty_exception *) {
    3334                        asm volatile ("# fixup block");
     
    3536        }
    3637        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;
    3839}
Note: See TracChangeset for help on using the changeset viewer.