-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathperfstat
executable file
·53 lines (47 loc) · 1.08 KB
/
perfstat
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
#!/bin/sh
# measure performance difference with huge pages vs. without
let_cpu_cool()
{
TEMP_LIMIT=$1
echo "Waiting for CPU cores to cool to $TEMP_LIMIT degrees C"
while (true)
do
sensors |\
awk 'BEGIN { max = 0; }
/^Core/ {
if (0 + $3 > max) {
max = 0 + $3;
}
}
END {
if (max > '"$1"')
exit 1;
else
exit 0; }'
if [ "$?" = "0" ]
then
break;
fi
sleep 1
done
echo "CPU temp has cooled to $TEMP_LIMIT degrees C"
}
run_test()
{
CACHE_AWARE="$1"
OUTPUTFILE="$2"
echo "Running with $CACHE_AWARE fraction of cache-aware particles..."
echo "START: $(date)"
# perf stat invocation cribbed from https://rigtorp.se/hugepages/
sudo perf stat -e 'faults,dTLB-loads,dTLB-load-misses,cache-misses,cache-references' \
./gaseous-giganticus --noise-scale 2.5 --velocity-factor 1300 --bands 10 \
-i input_image.png -o output_image -c 300 -K $CACHE_AWARE > "$OUTPUTFILE" 2>&1
echo "END: $(date)"
}
let_cpu_cool 35
run_test 0.0 test01.txt
let_cpu_cool 35
run_test 0.5 test02.txt
let_cpu_cool 35
run_test 1.0 test03.txt
grep misses test0[123].txt