This repository is currently being migrated. It's locked while the migration is in progress.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pcm-bw-histogram.sh
65 lines (49 loc) · 2.29 KB
/
pcm-bw-histogram.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
#!/bin/sh
if [ "$#" -ne 1 ]; then
echo
echo "Usage: $0 <duration>" >&2
echo
echo "duration is in the same format as the argument of sleep command:"
echo
sleep --help
exit 1
fi
out=bw-tmp
rm $out
echo
echo ========= CHECKING FOR PMM SUPPORT =========
echo
./pcm-memory.x -pmm -- sleep 1 &> tmp
dram_only=`cat tmp | grep "PMM traffic metrics are not available" | wc -l`
rm tmp
if [ $dram_only -gt 0 ]
then
echo PMM support is not present
else
echo PMM supoprt is present
fi
echo
echo ========= MEASURING =========
echo
if [ $dram_only -gt 0 ]
then
chrt --rr 1 nice --adjustment=-20 ./pcm-memory.x 0.005 -nc -csv=$out -- sleep $1
else
chrt --rr 1 nice --adjustment=-20 ./pcm-memory.x 0.005 -pmm -nc -csv=$out -- sleep $1
fi
cat $out | sed 's/;/,/g' > $out.csv
num_sockets=`lscpu | grep Socket | awk '{print $2}'`
echo
echo ======== POST-PROCESSING ====
echo
for s in `seq 0 $(($num_sockets-1))`; do
echo ============ Socket $s ============;
if [ $dram_only -gt 0 ]
then
cat $out.csv | cut -d, -f$((4*s+6)) | awk '{ n=n+1; f[int($1/10000)] = f[int($1/10000)] + 1; } END { print "bandwidth(GB/s),count,time(%),chart"; for (i=0; i<32; i++) { if(i in f){ v=100.*f[i]/n; printf "%d-%d\t,%d\t,%3.2f\t,",i*10,(i+1)*10,f[i],v; for (j=0; j<v; j++) printf "#"; print ""; }}}';
else
cat $out.csv | cut -d, -f$((5*s+7)) | awk '{ n=n+1; f[int($1/10000)] = f[int($1/10000)] + 1; } END { print "Memory bandwidth(GB/s),count,time(%),chart"; for (i=0; i<32; i++) { if(i in f){ v=100.*f[i]/n; printf "%d-%d\t,%d\t,%3.2f\t,",i*10,(i+1)*10,f[i],v; for (j=0; j<v; j++) printf "#"; print ""; }}}';
cat $out.csv | cut -d, -f$((5*s+5)) | awk '{ n=n+1; f[int($1/1000)] = f[int($1/1000)] + 1; } END { print "PMM read bandwidth(GB/s),count,time(%),chart"; for (i=0; i<32; i++) { if(i in f){ v=100.*f[i]/n; printf "%d-%d\t,%d\t,%3.2f\t,",i,(i+1),f[i],v; for (j=0; j<v; j++) printf "#"; print ""; }}}';
cat $out.csv | cut -d, -f$((5*s+6)) | awk '{ n=n+1; f[int($1/1000)] = f[int($1/1000)] + 1; } END { print "PMM write bandwidth(GB/s),count,time(%),chart"; for (i=0; i<32; i++) { if(i in f){ v=100.*f[i]/n; printf "%d-%d\t,%d\t,%3.2f\t,",i,(i+1),f[i],v; for (j=0; j<v; j++) printf "#"; print ""; }}}';
fi
done