-
Notifications
You must be signed in to change notification settings - Fork 1
/
monitor_bandwidth.sh
executable file
·172 lines (124 loc) · 4.1 KB
/
monitor_bandwidth.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/bin/bash
usage="$(basename "$0") <Sampling Rate> <Behchmark(ycsb|tpcc)>"
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
if [ "$#" -ne 2 ]; then
echo $usage >&2
exit 1
fi
while test $# -gt 0; do
case "$1" in
-h|--help) #-h flag for help
echo $usage >&2
exit 1
;;
*)
sampling=$1
if [[ $sampling =~ ^[+-]?[0-9]+$ ]]; then
echo "Sampling rate is set to ${sampling} sec"
elif [[ $sampling =~ ^[+-]?[0-9]+\.?[0-9]*$ ]]; then
echo "Sampling rate is set to ${sampling} sec"
else
echo "Sampling rate must be a number"
echo $usage >&2
exit 1
fi
benchmark=$2
break
;;
esac
done
modprobe msr
home_dir=$(pwd)
#====================================================================================================================================================
export VMMALLOC_POOL_SIZE=$((64*1024*1024*1024))
export VMMALLOC_POOL_DIR="/mnt/pmem1"
libvmmalloc_path="/usr/local/lib/libvmmalloc.so.1"
mkdir -p ${home_dir}/results/
mkdir -p ${home_dir}/results/bandwidth/
if [ -f "${home_dir}/results/bandwidth/memory_bandwidth.csv" ]; then
rm -f ${home_dir}/results/bandwidth/memory_bandwidth.csv
fi
if [ $benchmark = "ycsb" ]; then
cd ${home_dir}/ycsb-bench/
read -p "Please enter the input workload for YCSB --> a(default), b ,c, e: " workload
if [ "$workload" = "" ]; then
workload="a"
fi
read -p "Please enter the target index for YCSB --> fastfair(default), wbtree, bwtree, fptree, masstree): " index
if [ "$index" = "" ]; then
index="fastfair"
fi
read -p "Please enter the number of threads: " threads
if [ "$threads" = "" ]; then
threads=1
fi
read -p "Please specify the type of keys --> randint(default), string: " type
if [ "$type" = "" ]; then
type="randint"
fi
echo "\n"
echo "Executing YCSB Benchmark on Intel Optane DC. This may take a while..."
echo "Index: ${index}"
echo "Workload: ${workload}"
echo "Threads: ${threads}"
echo "Type: ${type}"
${home_dir}/pcm/build/bin/pcm-memory $sampling -csv=${home_dir}/results/bandwidth/memory_bandwidth.csv &
LD_PRELOAD=${libvmmalloc_path} ${home_dir}/ycsb-bench/build/ycsb ${index} ${workload} ${type} uniform ${threads}
#${home_dir}/ycsb-bench/build/ycsb ${index} ${workload} ${type} uniform ${threads}
pkill -9 -f pcm-memory
wait
echo "YCSB terminated"
echo ""
elif [ $benchmark = "tpcc" ]; then
cd ${home_dir}/tpccbench/build/src
read -p "Please enter the number of warehouses(default=10): " warehouses
if [ "$warehouses" = "" ]; then
warehouses=10
fi
read -p "Please enter the number of transactions(default=100000): " transactions
if [ "$transactions" = "" ]; then
transactions=10
fi
read -p "Please enter the target index --> fftree(default), pbwtree, wbtree, pmasstree: " index
if [ "$index" = "" ]; then
index="fftree"
fi
lib_index="lib${index}_wrapper.so"
echo "\n"
echo "Executing TPC-C Benchmark on Intel Optane DC. This may take a while..."
echo "Warehouses: ${warehouses}"
echo "Transactions: ${transactions}"
echo "Index: ${index}"
${home_dir}/pcm/build/bin/pcm-memory $sampling -csv=${home_dir}/results/bandwidth/memory_bandwidth.csv &
LD_PRELOAD=${libvmmalloc_path} ./tpcc ${warehouses} ${transactions} ${home_dir}/tpccbench/indexes/${lib_index}
#LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libjemalloc.so.2 /usr/local/lib/libvmmalloc.so.1" ./tpcc ${warehouses} ${transactions} ../${lib_index}
pkill -9 -f pcm-memory
wait
echo "TPC-C terminated"
echo ""
#elif [ $benchmark = "my_own_benchmark" ]; then
# cd /path/to/my/benchmark
# ${home_dir}/pcm/build/bin/pcm-memory $sampling -csv=${home_dir}/results/bandwidth/memory_bandwidth.csv &
# #LD_PRELOAD=${libvmmalloc_path} ./my_own_benchmark [arguments]
# pkill -9 -f pcm-memory
# wait
# echo "My own benchmark terminated"
# echo ""
else
echo "Unknown Benchmark ${benchmark}"
echo $usage >&2
exit 1
fi
unset VMMALLOC_POOL_SIZE
unset VMMALLOC_POOL_DIR
cd ${home_dir}
echo "Processing output..."
python3 ${home_dir}/process_bandwidth.py ${benchmark} ${home_dir}
echo "DONE!"
if [ -f "${home_dir}/results/bandwidth/memory_bandwidth.csv" ];
then
rm -f ${home_dir}/results/bandwidth/memory_bandwidth.csv
fi