Commit 75db8254 authored by nagayama15's avatar nagayama15

解析スクリプトに集計機能を追加

parent 0757d4f2
#!/bin/zsh
g() {
FILE=$(basename ${1/-log.txt/.c})
FUNCS=$(tail -n +2 $1 | wc -l)
BLOCKS=$(tail -n +2 $1 | awk '{a+=$2} END {print a}')
BITS=$(tail -n +2 $1 | awk '{a+=$3} END {print a}')
echo "$FILE, $FUNCS, $BLOCKS, $BITS"
}
f() {
for i in "$@"
do g $i
done
}
h() {
R=$(f $@)
FILES=$(echo $R | wc -l)
FUNCS=$(echo $R | awk '{a+=$2} END {print a}')
BLOCKS=$(echo $R | awk '{a+=$3} END {print a}')
BITS=$(echo $R | awk '{a+=$4} END {print a}')
echo "file, funcs, blocks, bits"
echo $R
echo "files: $FILES, funcs: $FUNCS, blocks: $BLOCKS, bits: $BITS"
}
h obj/example/8cc/stage1-wm/*-log.txt
h obj/example/zlib/zlib-77/*-log.txt
#!/bin/zsh #!/bin/zsh
g() { g() {
FILE=$(basename $1)
SIZE=$(stat -c %s $1) SIZE=$(stat -c %s $1)
LINES=$(wc -l $1 | awk '{print $1+1}') LINES=$(wc -l $1 | awk '{print $1+1}')
echo "$1, $SIZE, $LINES" echo "$FILE, $SIZE, $LINES"
} }
f() { f() {
...@@ -12,6 +13,16 @@ f() { ...@@ -12,6 +13,16 @@ f() {
done done
} }
echo "name, size, lines" h() {
f example/8cc/8cc/*.c R=$(f $@)
f example/zlib/zlib/*.c FILES=$(echo $R | wc -l)
SIZE=$(echo $R | awk '{a+=$2} END {print a}')
LINES=$(echo $R | awk '{a+=$3} END {print a}')
echo "name, size, lines"
echo "$R"
echo "files: $FILES, size: $SIZE, lines: $LINES"
}
h `ls example/8cc/8cc/*.c | awk -F 'example/8cc/8cc/utiltest.c' '{print $NF}'`
h example/zlib/zlib/*.c
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