-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbench.sh
executable file
·73 lines (65 loc) · 2.71 KB
/
bench.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
WARMUP=2
RUNS=3
FILES=(
"test/comparison/peterson.rav"
"test/comparison/bounded_counter.rav"
"test/comparison/inc_dec.rav"
"test/comparison/lclist.rav"
"test/comparison/barrier.rav"
"test/concurrent/lock/clh-lock.rav"
"test/comparison/fork_join.rav"
"test/concurrent/lock/mcs-lock.rav"
"test/comparison/msc_queue.rav"
"test/comparison/queue.rav"
""
"test/comparison/rwlock_duolock.rav"
"test/comparison/rwlock_lockless_faa.rav"
"test/comparison/rwlock_ticket_bounded.rav"
"test/comparison/rwlock_ticket_unbounded.rav"
""
"test/comparison/fork_join_client.rav"
""
"test/concurrent/lock/spin-lock_compact.rav"
"test/concurrent/lock/ticket-lock.rav"
"test/comparison/arc.rav"
"test/concurrent/treiber_stack/treiber_stack_atomics.rav"
"test/concurrent/counter/counter_monotonic.rav"
""
"test/comparison/tokens.rav"
""
"test/concurrent/templates/ccm.rav"
"test/concurrent/templates/flows_ra.rav"
"test/concurrent/templates/keyset_ra.rav"
"test/concurrent/templates/give-up.rav"
"test/concurrent/templates/bplustree.rav"
)
# Initialize CSV file
CSV_FILE="./benchmarks.csv"
echo "File,Program Length,Proof Declarations,Proof Instructions,Runtime" > "$CSV_FILE"
for file in "${FILES[@]}"; do
if [ -z "$file" ]; then
echo "" >> "$CSV_FILE"
continue
fi
echo "Running file $file"
line_count=$(wc -l < "$file")
output=$(raven "$file" --stats)
# Extract statistics from the output
program_declarations=$(echo "$output" | grep "Program Declarations" | awk '{print $3}')
proof_declarations=$(echo "$output" | grep "Proof Declarations" | awk '{print $3}')
program_instructions=$(echo "$output" | grep "Program Instructions" | awk '{print $3}')
proof_instructions=$(echo "$output" | grep "Proof Instructions" | awk '{print $3}')
proof_predicate_instructions=$(echo "$output" | grep "Proof Predicate Instructions" | awk '{print $4}')
proof_invariant_instructions=$(echo "$output" | grep "Proof Invariant Instructions" | awk '{print $4}')
proof_atomicity_instructions=$(echo "$output" | grep "Proof Atomicity Instructions" | awk '{print $4}')
proof_remaining_instructions=$(echo "$output" | grep "Proof Remaining Instructions" | awk '{print $4}')
specification_count=$(echo "$output" | grep "Specification Count" | awk '{print $3}')
program_length=$((program_declarations + program_instructions))
# Run hyperfine to measure runtime
runtime=$(hyperfine --warmup $WARMUP --runs $RUNS "raven \"$file\"" --export-json /tmp/hyperfine.json)
runtime=$(jq '.results[0].mean' /tmp/hyperfine.json)
runtime=$(printf "%.3f" "$runtime")
# Append statistics to CSV file
echo "$file,$program_length,$proof_declarations,$proof_instructions,$runtime" >> "$CSV_FILE"
done