diff --git a/ir_test.c b/ir_test.c index c88fc7f..7b33d3f 100644 --- a/ir_test.c +++ b/ir_test.c @@ -7,9 +7,11 @@ #include "ir.h" #include "ir_builder.h" -#include #include #include +#ifndef _WIN32 +# include +#endif #define BAILOUT 16 #define MAX_ITERATIONS 1000 @@ -57,10 +59,12 @@ typedef int (*mandelbrot_t)(double, double); void run(mandelbrot_t mandelbrot) { +#ifndef _WIN32 struct timeval aTv; gettimeofday(&aTv, NULL); long init_time = aTv.tv_sec; long init_usec = aTv.tv_usec; +#endif int x,y; for (y = -39; y < 39; y++) { @@ -75,9 +79,11 @@ void run(mandelbrot_t mandelbrot) } printf ("\n"); +#ifndef _WIN32 gettimeofday(&aTv,NULL); double query_time = (aTv.tv_sec - init_time) + (double)(aTv.tv_usec - init_usec)/1000000.0; printf ("C Elapsed %0.3f\n", query_time); +#endif } int main(int argc, char **argv) @@ -177,6 +183,7 @@ int main(int argc, char **argv) if (entry) { ir_disasm("test", entry, size, 0, &ctx, stderr); +#ifndef _WIN32 ir_perf_map_register("test", entry, size); ir_perf_jitdump_open(); ir_perf_jitdump_register("test", entry, size); @@ -184,10 +191,13 @@ int main(int argc, char **argv) ir_mem_unprotect(entry, 4096); ir_gdb_register("test", entry, size, sizeof(void*), 0); ir_mem_protect(entry, 4096); +#endif run((mandelbrot_t)entry); +#ifndef _WIN32 ir_perf_jitdump_close(); +#endif } ir_free(&ctx); diff --git a/win32/Makefile b/win32/Makefile index c5e4583..153c03e 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -59,11 +59,14 @@ OBJS_COMMON=$(BUILD_DIR)\ir.obj $(BUILD_DIR)\ir_strtab.obj $(BUILD_DIR)\ir_cfg.o OBJS_IR = $(BUILD_DIR)\ir_main.obj OBJS_IR_TEST = $(BUILD_DIR)\ir_test.obj -all: $(BUILD_DIR)\ir.exe +all: $(BUILD_DIR)\ir.exe $(BUILD_DIR)\ir_test.exe $(BUILD_DIR)\ir.exe: builddir capstone $(BUILD_DIR)\ir_emit_$(DASM_ARCH).h $(BUILD_DIR)\ir_fold_hash.h $(OBJS_IR) $(OBJS_COMMON) "$(LD)" $(LDFLAGS) $(OBJS_COMMON) $(OBJS_IR) $(LIBS) /out:$@ +$(BUILD_DIR)\ir_test.exe: builddir capstone $(BUILD_DIR)\ir_emit_$(DASM_ARCH).h $(BUILD_DIR)\ir_fold_hash.h $(OBJS_IR_TEST) $(OBJS_COMMON) + "$(LD)" $(LDFLAGS) $(OBJS_COMMON) $(OBJS_IR_TEST) $(LIBS) /out:$@ + $(BUILD_DIR)\ir_fold_hash.h: $(BUILD_DIR)\gen_ir_fold_hash.exe $(SRC_DIR)\ir_fold.h $(SRC_DIR)\ir.h $(BUILD_DIR)\gen_ir_fold_hash.exe < $(SRC_DIR)\ir_fold.h > $(BUILD_DIR)\ir_fold_hash.h $(BUILD_DIR)\gen_ir_fold_hash.exe: $(SRC_DIR)\gen_ir_fold_hash.c $(SRC_DIR)\ir_strtab.c