X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=src%2Fexec.c;h=19be801122bbca5cd3c1b4dcaf6b42af00ca239c;hp=d811c92611f94437274fdd8ce46120f7a40d2038;hb=b4e48008c95b35c692827326191698c22b06124f;hpb=5d41f32f8e26c4f3d6e0186d960a5f3b98dcab27 diff --git a/src/exec.c b/src/exec.c index d811c92..19be801 100644 --- a/src/exec.c +++ b/src/exec.c @@ -266,6 +266,8 @@ void exec() WORD op, r_r1, x_r2, val; CMDTYPE cmdtype; char *errpr = malloc(8); + clock_t clock_begin, clock_end; + if(tracemode) { fprintf(stdout, "\nExecuting machine codes\n"); } @@ -278,6 +280,7 @@ void exec() } /* 機械語の実行 */ for (; ; ) { + clock_begin = clock(); /* プログラムレジスタのアドレスが主記憶の範囲外の場合はエラー */ if(PR >= MEMSIZE) { sprintf(errpr, "PR:#%04X", PR); @@ -448,6 +451,9 @@ void exec() default: break; } + do { + clock_end = clock(); + } while(clock_end - clock_begin < CLOCKS_PER_SEC / CLOCKS); } execerr: fprintf(stderr, "Execute error - %d: %s\n", cerrno, cerrmsg);