Commit f5292cf0 authored by nagayama15's avatar nagayama15

集計スクリプトを更新

parent 9bc6505e
...@@ -66,7 +66,7 @@ ${OBJ_DIR}/zlib-wm/%.o: zlib/%.c ...@@ -66,7 +66,7 @@ ${OBJ_DIR}/zlib-wm/%.o: zlib/%.c
@mkdir -p ${@D} @mkdir -p ${@D}
clang ${CFLAGS} -emit-llvm -S -o ${@:.o=.ll} $< clang ${CFLAGS} -emit-llvm -S -o ${@:.o=.ll} $<
opt -load=${ROOT}/bin/src/nykk.so -block-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-block-wm.ll} ${@:.o=.ll} 2> ${@:%.o=%-block-wm.txt} opt -load=${ROOT}/bin/src/nykk.so -block-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-block-wm.ll} ${@:.o=.ll} 2> ${@:%.o=%-block-wm.txt}
opt -load=${ROOT}/bin/src/nykk.so -block-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-inst-wm.ll} ${@:.o=-block-wm.ll} 2> ${@:%.o=%-inst-wm.txt} opt -load=${ROOT}/bin/src/nykk.so -inst-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-inst-wm.ll} ${@:.o=-block-wm.ll} 2> ${@:%.o=%-inst-wm.txt}
clang ${CFLAGS} -o $@ -c ${@:%.o=%-inst-wm.ll} clang ${CFLAGS} -o $@ -c ${@:%.o=%-inst-wm.ll}
${OBJ_DIR}/test.o: test.cpp ${OBJ_DIR}/test.o: test.cpp
......
#!/bin/zsh #!/bin/zsh
g() { g1() {
FILE=$(basename ${1/-block-wm.txt/.c}) FILE=$(basename ${1/-block-wm.txt/.c})
FUNCS=$(tail -n +2 $1 | wc -l) FUNCS=$(tail -n +2 $1 | wc -l)
BLOCKS=$(tail -n +2 $1 | awk '{a+=$2} END {print a}') BLOCKS=$(tail -n +2 $1 | awk '{a+=$2} END {print a}')
...@@ -8,19 +8,44 @@ g() { ...@@ -8,19 +8,44 @@ g() {
echo "$FILE, $FUNCS, $BLOCKS, $BITS" echo "$FILE, $FUNCS, $BLOCKS, $BITS"
} }
f() { f1() {
for i in "$@" for i in "$@"
do g $i do g1 $i
done done
} }
h() { h1() {
R=$(f $@) R=$(f1 $@)
echo "file, funcs, blocks, bits" echo "file, funcs, blocks, bits"
echo "$R" echo "$R"
echo "$R" | awk '{f++; a+=$2; b+=$3; c+=$4} END {print "files: " f ", funcs: " a ", blocks: " b ", bits: " c}' echo "$R" | awk '{f++; a+=$2; b+=$3; c+=$4} END {print "files: " f ", funcs: " a ", blocks: " b ", bits: " c}'
} }
h obj/example/8cc/stage1-wm/*-block-wm.txt g2() {
h obj/example/zlib/zlib-wm/*-block-wm.txt FILE=$(basename ${1/-inst-wm.txt/.c})
INSTS=$(tail -n +2 $1 | awk '{a+=$2} END {print a}')
BITS=$(tail -n +2 $1 | awk '{a+=$3} END {print a}')
echo "$FILE, $INSTS, $BITS"
}
f2() {
for i in "$@"
do g2 $i
done
}
h2() {
R=$(f2 $@)
echo "file, insts, bits"
echo "$R"
echo "$R" | awk '{f++; a+=$2; b+=$3} END {print "files: " f ", insts: " a ", bits: " b}'
}
h1 obj/example/8cc/stage1-wm/*-block-wm.txt
h1 obj/example/zlib/zlib-wm/*-block-wm.txt
h2 obj/example/8cc/stage1-wm/*-inst-wm.txt
h2 obj/example/zlib/zlib-wm/*-inst-wm.txt
...@@ -104,7 +104,7 @@ namespace ...@@ -104,7 +104,7 @@ namespace
} }
} }
llvm::errs() << block.getParent()->getName() << "," << block.size() << "," << num_embedded_bits << "\n"; llvm::errs() << block.getParent()->getName() << ", " << block.size() << ", " << num_embedded_bits << "\n";
return is_changed; return is_changed;
} }
......
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