From 151307bc11cff63a5b026a4a8b0807bb6280b937 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 12 Jul 2019 17:39:18 +0200 Subject: (#143) More features --- test/monniaux/cycles.h | 9 +++++---- test/monniaux/sandbox/Makefile | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'test/monniaux') diff --git a/test/monniaux/cycles.h b/test/monniaux/cycles.h index c7978ff4..8012a013 100644 --- a/test/monniaux/cycles.h +++ b/test/monniaux/cycles.h @@ -1,9 +1,10 @@ #include +#include typedef unsigned long cycle_t; #ifdef MAX_MEASURES - cycle_t _last_stop = 0; - cycle_t _total_cycles[MAX_MEASURES] = {0}; + static cycle_t _last_stop[MAX_MEASURES] = {0}; + static cycle_t _total_cycles[MAX_MEASURES] = {0}; #endif #ifdef __K1C__ @@ -43,7 +44,7 @@ static inline cycle_t get_cycle(void) { return 0; } #endif #ifdef MAX_MEASURES - #define TIMEINIT {_last_stop = get_cycle();} - #define TIMESTOP(i) {cycle_t cur = get_cycle(); _total_cycles[i] += cur - _last_stop; _last_stop = cur;} + #define TIMEINIT(i) {_last_stop[i] = get_cycle();} + #define TIMESTOP(i) {cycle_t cur = get_cycle(); _total_cycles[i] += cur - _last_stop[i]; _last_stop[i] = cur;} #define TIMEPRINT(n) { for (int i = 0; i <= n; i++) printf("(%d) cycles: %" PRIu64 "\n", i, _total_cycles[i]); } #endif diff --git a/test/monniaux/sandbox/Makefile b/test/monniaux/sandbox/Makefile index fdb24685..0fa2a2ae 100644 --- a/test/monniaux/sandbox/Makefile +++ b/test/monniaux/sandbox/Makefile @@ -14,7 +14,8 @@ CLOCK=../clock.gcc.k1c.o MAX_MEASURES=10 # Flags common to both compilers, then to gcc, then to ccomp -ALL_CFLAGS=-g -Wall -D__K1C_COS__ -DMAX_MEASURES=$(MAX_MEASURES) +ALL_CFLAGS=-Wall -D__K1C_COS__ -DMAX_MEASURES=$(MAX_MEASURES) +#ALL_CFLAGS+=-g ALL_GCCFLAGS=$(ALL_CFLAGS) -std=c99 -Wextra -Werror=implicit ALL_CCOMPFLAGS=$(ALL_CFLAGS) @@ -26,19 +27,19 @@ K1C_CCOMP=ccomp EXECUTE_CYCLES=k1-cluster --syscall=libstd_scalls.so --cycle-based -- # You can define up to GCC4FLAGS and CCOMP4FLAGS -GCC0FLAGS=$(ALL_GCCFLAGS) -O0 +GCC0FLAGS= GCC1FLAGS=$(ALL_GCCFLAGS) -O1 GCC2FLAGS=$(ALL_GCCFLAGS) -O2 GCC3FLAGS=$(ALL_GCCFLAGS) -O3 GCC4FLAGS= -CCOMP0FLAGS=$(ALL_CCOMPFLAGS) -O0 +CCOMP0FLAGS= CCOMP1FLAGS=$(ALL_CCOMPFLAGS) -fno-postpass CCOMP2FLAGS=$(ALL_CCOMPFLAGS) CCOMP3FLAGS= CCOMP4FLAGS= # Prefix names -GCC0PREFIX=.gcc.o0 +GCC0PREFIX= GCC1PREFIX=.gcc.o1 GCC2PREFIX=.gcc.o2 GCC3PREFIX=.gcc.o3 @@ -51,6 +52,7 @@ CCOMP4PREFIX= # List of outfiles, updated by gen_rules OUTFILES:= +BINFILES:= # First line of the CSV file FIRSTLINE:=benches @@ -72,6 +74,7 @@ bin/$(TARGET)$(3).bin: $(addprefix obj/,$(ALL_CFILES:.c=$(3).o)) $(CLOCK) @mkdir -p $$(@D) $(K1C_CC) $$+ -lm -o $$@ +BINFILES:=$(BINFILES) bin/$(TARGET)$(3).bin OUTFILES:=$(OUTFILES) out/$(TARGET)$(3).out FIRSTLINE:=$(FIRSTLINE), $(3) @@ -134,9 +137,12 @@ measures.csv: $(OUTFILES) done;\ echo "$@ created!" -.PHONY: all clean -all: measures.csv +.PHONY: all clean run +all: $(BINFILES) + +run: measures.csv clean: rm -f *.o *.s *.bin *.out + rm -f asm/*.s bin/*.bin obj/*.o out/*.out -- cgit