Commit 7fb64c44 authored by nagayama15's avatar nagayama15

透かしによる実行速度変化のベンチマークを追加

parent 7f423559
include ../../common.mk include ../../common.mk
WATERMARK := 77
CC := clang CC := clang
CXX := clang++ CXX := clang++
...@@ -42,85 +40,82 @@ SRCS := \ ...@@ -42,85 +40,82 @@ SRCS := \
zlib/uncompr.c \ zlib/uncompr.c \
zlib/zutil.c zlib/zutil.c
OBJS := ${SRCS:zlib/%.c=${OBJ_DIR}/zlib/%.o} # $(call watermark,<watermark>)
OBJS_BWM := ${SRCS:zlib/%.c=${OBJ_DIR}/zlib-block-wm/%.o} define watermark
OBJS_IWM := ${SRCS:zlib/%.c=${OBJ_DIR}/zlib-inst-wm/%.o} .PRECIOUS: \
OBJS_WM := ${SRCS:zlib/%.c=${OBJ_DIR}/zlib-wm/%.o} $${SRCS:zlib/%.c=$${OBJ_DIR}/$1/%-block-wm.ll} \
$${SRCS:zlib/%.c=$${OBJ_DIR}/$1/%-inst-wm.ll} \
.PHONY: all test $${SRCS:zlib/%.c=$${OBJ_DIR}/$1/%-wm.ll}
all: \ all: \
${BIN_DIR}/benchmark \ $${BIN_DIR}/$1/benchmark-block-wm \
${BIN_DIR}/benchmark-block-wm \ $${BIN_DIR}/$1/benchmark-inst-wm \
${BIN_DIR}/benchmark-inst-wm \ $${BIN_DIR}/$1/benchmark-wm
${BIN_DIR}/benchmark-wm
test: \ test: \
${BIN_DIR}/benchmark \ $${BIN_DIR}/$1/benchmark-block-wm \
${BIN_DIR}/benchmark-block-wm \ $${BIN_DIR}/$1/benchmark-inst-wm \
${BIN_DIR}/benchmark-inst-wm \ $${BIN_DIR}/$1/benchmark-wm
${BIN_DIR}/benchmark-wm
benchmark: benchmark:: \
${BIN_DIR}/benchmark | tee ${BIN_DIR}/benchmark.txt $${BIN_DIR}/$1/benchmark-block-wm \
${BIN_DIR}/benchmark-block-wm | tee ${BIN_DIR}/benchmark-block-wm.txt $${BIN_DIR}/$1/benchmark-inst-wm \
${BIN_DIR}/benchmark-inst-wm | tee ${BIN_DIR}/benchmark-inst-wm.txt $${BIN_DIR}/$1/benchmark-wm
${BIN_DIR}/benchmark-wm | tee ${BIN_DIR}/benchmark-wm.txt $${BIN_DIR}/$1/benchmark-block-wm | tee $${BIN_DIR}/$1/benchmark-block-wm.txt
paste -d"," ${BIN_DIR}/benchmark.txt ${BIN_DIR}/benchmark-block-wm.txt ${BIN_DIR}/benchmark-inst-wm.txt ${BIN_DIR}/benchmark-wm.txt > ${BIN_DIR}/benchmark.csv $${BIN_DIR}/$1/benchmark-inst-wm | tee $${BIN_DIR}/$1/benchmark-inst-wm.txt
$${BIN_DIR}/$1/benchmark-wm | tee $${BIN_DIR}/$1/benchmark-wm.txt
paste -d "\t" $${BIN_DIR}/benchmark.txt $${BIN_DIR}/$1/benchmark-block-wm.txt $${BIN_DIR}/$1/benchmark-inst-wm.txt $${BIN_DIR}/$1/benchmark-wm.txt > $${BIN_DIR}/$1/benchmark.csv
${BIN_DIR}/libz.a: ${OBJS} $${BIN_DIR}/$1/libz-block-wm.a: $${SRCS:zlib/%.c=$${OBJ_DIR}/$1/%-block-wm.o}
${BIN_DIR}/libz-block-wm.a: ${OBJS_BWM} $${BIN_DIR}/$1/libz-inst-wm.a: $${SRCS:zlib/%.c=$${OBJ_DIR}/$1/%-inst-wm.o}
${BIN_DIR}/libz-inst-wm.a: ${OBJS_IWM} $${BIN_DIR}/$1/libz-wm.a: $${SRCS:zlib/%.c=$${OBJ_DIR}/$1/%-wm.o}
${BIN_DIR}/libz-wm.a: ${OBJS_WM}
${BIN_DIR}/benchmark: ${OBJ_DIR}/benchmark.o ${BIN_DIR}/libz.a $${BIN_DIR}/$1/benchmark-%: $${OBJ_DIR}/benchmark.o $${BIN_DIR}/$1/libz-%.a
${BIN_DIR}/benchmark-block-wm: ${OBJ_DIR}/benchmark.o ${BIN_DIR}/libz-block-wm.a @mkdir -p $${@D}
${BIN_DIR}/benchmark-inst-wm: ${OBJ_DIR}/benchmark.o ${BIN_DIR}/libz-inst-wm.a $${CXX} $${CXXFLAGS} -o $$@ $$^ $${LDFLAGS}
${BIN_DIR}/benchmark-wm: ${OBJ_DIR}/benchmark.o ${BIN_DIR}/libz-wm.a
${OBJ_DIR}/zlib/%.o: zlib/%.c $${OBJ_DIR}/$1/%-block-wm.ll: $${OBJ_DIR}/%.ll
@mkdir -p ${@D} @mkdir -p $${@D}
${CC} ${CFLAGS} -o $@ -c $< opt -load=$${ROOT}/bin/$${BUILD_TYPE}/src/nykk.so -block-wm -watermark="$1" -S -o $$@ $$< 2> $${@:%.ll=%.txt}
${OBJ_DIR}/zlib-block-wm/%.o: zlib/%.c $${OBJ_DIR}/$1/%-inst-wm.ll: $${OBJ_DIR}/%.ll
@mkdir -p ${@D} @mkdir -p $${@D}
clang ${CFLAGS} -emit-llvm -S -o ${@:.o=.ll} $< opt -load=$${ROOT}/bin/$${BUILD_TYPE}/src/nykk.so -inst-wm -watermark="$1" -S -o $$@ $$< 2> $${@:%.ll=%.txt}
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -block-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-block-wm.ll} ${@:.o=.ll} 2> ${@:%.o=%-block-wm.txt}
clang ${CFLAGS} -o $@ -c ${@:%.o=%-block-wm.ll}
${OBJ_DIR}/zlib-inst-wm/%.o: zlib/%.c $${OBJ_DIR}/$1/%-wm.ll: $${OBJ_DIR}/$1/%-block-wm.ll
@mkdir -p ${@D} opt -load=$${ROOT}/bin/$${BUILD_TYPE}/src/nykk.so -inst-wm -watermark="$1" -S -o $$@ $$< 2> /dev/null
clang ${CFLAGS} -emit-llvm -S -o ${@:.o=.ll} $< endef
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -inst-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-inst-wm.ll} ${@:.o=.ll} 2> ${@:%.o=%-inst-wm.txt}
clang ${CFLAGS} -o $@ -c ${@:%.o=%-inst-wm.ll}
${OBJ_DIR}/zlib-wm/%.o: zlib/%.c .PRECIOUS: ${SRCS:zlib/%.c=${OBJ_DIR}/%.ll}
@mkdir -p ${@D}
clang ${CFLAGS} -emit-llvm -S -o ${@:.o=.ll} $<
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -block-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-block-wm.ll} ${@:.o=.ll} 2> /dev/null
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -inst-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-inst-wm.ll} ${@:.o=-block-wm.ll} 2> /dev/null
clang ${CFLAGS} -o $@ -c ${@:%.o=%-inst-wm.ll}
${OBJ_DIR}/benchmark.o: benchmark.cpp all: ${BIN_DIR}/benchmark
@mkdir -p ${@D} test: ${BIN_DIR}/benchmark
${CXX} ${CXXFLAGS} -o $@ -c $<
${BIN_DIR}/benchmark: benchmark:: ${BIN_DIR}/benchmark
@mkdir -p ${@D} ${BIN_DIR}/benchmark | tee ${BIN_DIR}/benchmark.txt
${CXX} ${CXXFLAGS} -o $@ $^ ${LDFLAGS}
${BIN_DIR}/benchmark-block-wm: ${BIN_DIR}/libz.a: ${SRCS:zlib/%.c=${OBJ_DIR}/%.o}
@mkdir -p ${@D}
${BIN_DIR}/benchmark: ${OBJ_DIR}/benchmark.o ${BIN_DIR}/libz.a
${CXX} ${CXXFLAGS} -o $@ $^ ${LDFLAGS} ${CXX} ${CXXFLAGS} -o $@ $^ ${LDFLAGS}
${BIN_DIR}/benchmark-inst-wm: ${OBJ_DIR}/%.ll: zlib/%.c
@mkdir -p ${@D} @mkdir -p ${@D}
${CXX} ${CXXFLAGS} -o $@ $^ ${LDFLAGS} clang ${CFLAGS} -S -emit-llvm -o $@ -c $<
${BIN_DIR}/benchmark-wm: ${OBJ_DIR}/benchmark.o: benchmark.cpp
@mkdir -p ${@D} @mkdir -p ${@D}
${CXX} ${CXXFLAGS} -o $@ $^ ${LDFLAGS} ${CXX} ${CXXFLAGS} -o $@ -c $<
%.a: %.a:
@mkdir -p ${@D} @mkdir -p ${@D}
${AR} rcs $@ $^ ${AR} rcs $@ $^
%.o: %.ll
clang -o $@ -c $<
$(eval $(call watermark,zlib-watermark))
$(eval $(call watermark,92bb9dcfd3b9f053d35c77c4c8796c6a))
$(eval $(call watermark,48d92373664b84ba9399cb6072220ee5))
$(eval $(call watermark,28e2fb60e8dc7c19cf6f9a06a7582ef3))
#$(eval $(call watermark,e94d310dfb9d89a0f2dd50ce5132493d))
...@@ -47,7 +47,7 @@ h2() { ...@@ -47,7 +47,7 @@ h2() {
echo "==== 8cc block-wm ====" echo "==== 8cc block-wm ===="
h1 obj/$1/example/8cc/stage1-wm/*-block-wm.txt h1 obj/$1/example/8cc/stage1-wm/*-block-wm.txt
echo "==== zlib block-wm ====" echo "==== zlib block-wm ===="
h1 obj/$1/example/zlib/zlib-block-wm/*-block-wm.txt h1 obj/$1/example/zlib/zlib-watermark/*-block-wm.txt
echo "==== lua block-wm ====" echo "==== lua block-wm ===="
h1 obj/$1/example/lua/*-block-wm.txt h1 obj/$1/example/lua/*-block-wm.txt
echo "==== cJSON block-wm ====" echo "==== cJSON block-wm ===="
...@@ -64,7 +64,7 @@ h1 obj/$1/example/numguess-rs/*-block-wm.txt ...@@ -64,7 +64,7 @@ h1 obj/$1/example/numguess-rs/*-block-wm.txt
echo "==== 8cc inst-wm ====" echo "==== 8cc inst-wm ===="
h2 obj/$1/example/8cc/stage1-wm/*-inst-wm.txt h2 obj/$1/example/8cc/stage1-wm/*-inst-wm.txt
echo "==== zlib inst-wm ====" echo "==== zlib inst-wm ===="
h2 obj/$1/example/zlib/zlib-inst-wm/*-inst-wm.txt h2 obj/$1/example/zlib/zlib-watermark/*-inst-wm.txt
echo "==== lua inst-wm ====" echo "==== lua inst-wm ===="
h2 obj/$1/example/lua/*-inst-wm.txt h2 obj/$1/example/lua/*-inst-wm.txt
echo "==== cJSON inst-wm ====" echo "==== cJSON inst-wm ===="
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment