diff --git a/Makefile b/Makefile index 1ed8a04..9d81248 100644 --- a/Makefile +++ b/Makefile @@ -45,21 +45,21 @@ rigorous_speed_demo: clean $(RIGOROUS_SPEED_STATS) #: Really, how slow is it? @printf "ifunc\t"; cat speed_demo_ifunc.stats.txt @echo "" -RIDICULOUS_STATS=speed_demo_fixed.stats.txt \ - speed_demo_ifunc.stats.txt \ - speed_demo_pointer.stats.txt \ - speed_demo_struct.stats.txt \ - speed_demo_always.stats.txt \ - speed_demo_upfront.stats.txt +RIDICULOUS_STATS=fixed.stats.txt \ + ifunc.stats.txt \ + pointer.stats.txt \ + struct.stats.txt \ + always.stats.txt \ + upfront.stats.txt ridiculous_speed_demo: clean $(RIDICULOUS_STATS) #: Compare other techniques $(call banner, Final Results) @echo "TEST LOW HIGH AVG" - @printf "fixed\t"; cat speed_demo_fixed.stats.txt - @printf "pointer\t"; cat speed_demo_pointer.stats.txt - @printf "struct\t"; cat speed_demo_struct.stats.txt - @printf "ifunc\t"; cat speed_demo_ifunc.stats.txt - @printf "upfront\t"; cat speed_demo_upfront.stats.txt - @printf "always\t"; cat speed_demo_always.stats.txt + @printf "fixed\t"; cat fixed.stats.txt + @printf "pointer\t"; cat pointer.stats.txt + @printf "struct\t"; cat struct.stats.txt + @printf "ifunc\t"; cat ifunc.stats.txt + @printf "upfront\t"; cat upfront.stats.txt + @printf "always\t"; cat always.stats.txt @echo "" %.stats.txt: %.low.txt %.high.txt %.avg.txt @@ -74,9 +74,9 @@ ridiculous_speed_demo: clean $(RIDICULOUS_STATS) #: Compare other techniques %.avg.txt: %.timings.txt awk '{ sum += $$1 }; END { print sum/NR }' $< > $@ -%.timings.txt: %.exe +%.timings.txt: code/speed_demo/%/main.exe $(call banner, Sampling performance of $<) - (for i in `seq 1 10`; do \ + (for i in `seq 1 2`; do \ time -f "%U" ./$<; \ done) 2>&1 | tee $@ @@ -95,8 +95,11 @@ vector_add.exe: code/vector_add.c plt_example.exe: code/plt_example.c gcc -fPIC -no-pie -o $@ $< -%.exe: code/%.c - gcc -o $@ $< +speed_demo_%.exe: code/speed_demo/%/main.exe + cp $< $@ + +code/speed_demo/%/main.exe: + make -C code/speed_demo/$* main.exe %.plt: %.exe objdump -d -r $< \ diff --git a/code/speed_demo/always/Makefile b/code/speed_demo/always/Makefile new file mode 100644 index 0000000..74bca7b --- /dev/null +++ b/code/speed_demo/always/Makefile @@ -0,0 +1,2 @@ +main.exe: main.c + gcc $< -o $@ diff --git a/code/speed_demo_always.c b/code/speed_demo/always/main.c similarity index 100% rename from code/speed_demo_always.c rename to code/speed_demo/always/main.c diff --git a/code/speed_demo/fixed/Makefile b/code/speed_demo/fixed/Makefile new file mode 100644 index 0000000..74bca7b --- /dev/null +++ b/code/speed_demo/fixed/Makefile @@ -0,0 +1,2 @@ +main.exe: main.c + gcc $< -o $@ diff --git a/code/speed_demo_fixed.c b/code/speed_demo/fixed/main.c similarity index 100% rename from code/speed_demo_fixed.c rename to code/speed_demo/fixed/main.c diff --git a/code/speed_demo/ifunc/Makefile b/code/speed_demo/ifunc/Makefile new file mode 100644 index 0000000..74bca7b --- /dev/null +++ b/code/speed_demo/ifunc/Makefile @@ -0,0 +1,2 @@ +main.exe: main.c + gcc $< -o $@ diff --git a/code/speed_demo_ifunc.c b/code/speed_demo/ifunc/main.c similarity index 100% rename from code/speed_demo_ifunc.c rename to code/speed_demo/ifunc/main.c diff --git a/code/speed_demo/pointer/Makefile b/code/speed_demo/pointer/Makefile new file mode 100644 index 0000000..74bca7b --- /dev/null +++ b/code/speed_demo/pointer/Makefile @@ -0,0 +1,2 @@ +main.exe: main.c + gcc $< -o $@ diff --git a/code/speed_demo_pointer.c b/code/speed_demo/pointer/main.c similarity index 100% rename from code/speed_demo_pointer.c rename to code/speed_demo/pointer/main.c diff --git a/code/speed_demo/struct/Makefile b/code/speed_demo/struct/Makefile new file mode 100644 index 0000000..74bca7b --- /dev/null +++ b/code/speed_demo/struct/Makefile @@ -0,0 +1,2 @@ +main.exe: main.c + gcc $< -o $@ diff --git a/code/speed_demo_struct.c b/code/speed_demo/struct/main.c similarity index 100% rename from code/speed_demo_struct.c rename to code/speed_demo/struct/main.c diff --git a/code/speed_demo/upfront/Makefile b/code/speed_demo/upfront/Makefile new file mode 100644 index 0000000..74bca7b --- /dev/null +++ b/code/speed_demo/upfront/Makefile @@ -0,0 +1,2 @@ +main.exe: main.c + gcc $< -o $@ diff --git a/code/speed_demo_upfront.c b/code/speed_demo/upfront/main.c similarity index 100% rename from code/speed_demo_upfront.c rename to code/speed_demo/upfront/main.c