File size: 1,310 Bytes
cf6b956
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
# Validate the captured SimPoint traces and produce the steady-state evidence.
set -euo pipefail

W=/work/simpoint_flow/sqlite
DR=$DYNAMORIO_HOME
V=$W/validation
rm -rf "$V"; mkdir -p "$V/basic_counts" "$V/steady_state" "$V/trace"

mapfile -t PAIRS < "$W/simpoints/selected.txt"

echo -e "cluster\tsegment\tzip_test\tsha256\tbytes" > "$V/zip_integrity.tsv"
for pair in "${PAIRS[@]}"; do
    seg=${pair%% *}; cl=${pair##* }
    z="$W/traces_simp/trace/$seg.zip"
    if unzip -t "$z" > "$V/trace/unzip-test-$seg.log" 2>&1; then st=PASS; else st=FAIL; fi
    printf '%s\t%s\t%s\t%s\t%s\n' "$cl" "$seg" "$st" \
        "$(sha256sum "$z" | cut -d' ' -f1)" "$(stat -c%s "$z")" >> "$V/zip_integrity.tsv"

    # drcachesim wants a trace directory holding bin/ and trace/
    d="$V/.work/$seg"; rm -rf "$d"; mkdir -p "$d/trace" "$d/bin"
    cp "$W/traces_simp/bin/modules.log" "$d/bin/modules.log"
    cp "$z" "$d/trace/$seg.zip"

    "$DR"/tools/bin64/drcachesim -simulator_type basic_counts -indir "$d" \
        > "$V/basic_counts/segment-$seg.log" 2>&1
    "$DR"/tools/bin64/drcachesim -simulator_type histogram -report_top 60 \
        -indir "$d" > "$V/steady_state/raw_pc_histogram-segment-$seg.txt" 2>&1
done

cp "$W/traces_simp/bin/modules.log" "$V/steady_state/modules.log"
echo "validation done"