Skip to content

Commit ad88d96

Browse files
committed
Add run_sweep.sh script for sweeping miss and retention ratios of GroupMerge variants
1 parent fc20e37 commit ad88d96

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

run_sweep.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
# Sweep miss ratio and retention ratio for the four GroupMerge variants.
3+
# Usage: run_sweep.sh <trace_path> <trace_format> <out_csv> <size1> [size2 ...]
4+
set -u
5+
TRACE="$1"
6+
FMT="$2"
7+
OUT="$3"
8+
shift 3
9+
SIZES=("$@")
10+
11+
BIN="/proj/cache-PG0/jason/libcachesim_google/_build/bin/cachesim"
12+
ALGOS=(groupmerge groupmergehead groupmergeadaptive groupmergeadaptive2)
13+
14+
echo "algo,size,miss_ratio,byte_miss_ratio,retain_ratio" > "$OUT"
15+
for algo in "${ALGOS[@]}"; do
16+
for sz in "${SIZES[@]}"; do
17+
log=$("$BIN" "$TRACE" "$FMT" "$algo" "$sz" 2>&1)
18+
mr=$(echo "$log" | grep -oE "miss ratio [0-9.]+" | tail -1 | awk '{print $3}')
19+
bmr=$(echo "$log" | grep -oE "byte miss ratio [0-9.]+" | tail -1 | awk '{print $4}')
20+
rr=$(echo "$log" | grep -oE "byte ratio = [0-9.]+" | tail -1 | awk '{print $4}')
21+
echo "$algo,$sz,$mr,$bmr,$rr" | tee -a "$OUT"
22+
done
23+
done

0 commit comments

Comments
 (0)