-
Notifications
You must be signed in to change notification settings - Fork 0
/
count.sh
executable file
·45 lines (27 loc) · 1.59 KB
/
count.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
code=$(cloc --hide-rate --quiet --sum-one -csv --list-file source_code_file_list | awk 'END{print}' | awk -F "," '{print $NF}')
instr=$(cat source_code_file_list | xargs grep -E -- '\/\*CN\*\/' | wc -l | tr -d ' ')
spec=$(cat source_code_file_list | xargs grep -E -- '\/\*\@' | wc -l | tr -d ' ')
defs_cloc_output=$(cloc --hide-rate --quiet --sum-one -csv defs.h | awk 'END{print}')
lemmas_cloc_output=$(cloc --hide-rate --quiet --sum-one -csv lemmas.h | awk 'END{print}')
defs_code=$(echo $defs_cloc_output | awk -F "," '{print $NF}')
defs_comments=$(echo $defs_cloc_output | awk -F "," '{print $(NF-1)}')
lemmas_code=$(echo $lemmas_cloc_output | awk -F "," '{print $NF}')
lemmas_comments=$(echo $lemmas_cloc_output | awk -F "," '{print $(NF-1)}')
defs=$(($defs_code + $defs_comments))
lemma_stmnts=$(($lemmas_code + $lemmas_comments))
coq_proofs=$(cloc --hide-rate --quiet --sum-one -csv --list-file coq_proof_file_list | awk 'END{print}' | awk -F "," '{print $NF}')
formalisation=$(($instr + $spec + $defs + $lemma_stmnts + $coq_proofs))
formalisation_without_coq=$(($instr + $spec + $defs + $lemma_stmnts))
overhead=$( echo "$formalisation / $code" | bc -l )
pure_cn_overhead=$( echo "$formalisation_without_coq / $code" | bc -l )
coq_overhead=$( echo "$coq_proofs / $code" | bc -l )
echo "Code: $code"
echo "Instr: $instr"
echo "Spec: $spec"
echo "Definitions: $defs"
echo "Lemma stmts: $lemma_stmnts"
echo "Coq proof: $coq_proofs"
echo "Formalisation total: $formalisation"
echo "Overhead without Coq proofs: $pure_cn_overhead"
echo "Overhead of Coq proofs: $coq_overhead"
echo "Overhead total: $overhead"