-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlmbench-regression
executable file
·288 lines (256 loc) · 5.36 KB
/
lmbench-regression
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
#!/bin/bash
# lmbench - run the lmbench benchmark suite.
#
# Copyright (c) 1994 Larry McVoy. GPLed software.
# $Id$
# Make sure we can find: ./cmd, df, and netstat
PATH=.:../../scripts:$PATH:/etc:/usr/etc:/sbin:/usr/sbin
export PATH
echo PATH = $PATH
echo lat_syscall = `readlink -f lat_syscall`
# lat_unix, lat_udp, lat_tcp only do one run!!!
# we loop to repeat the tests
N_RUNS=6
if [ -f $1 ]
then . $1
echo Using config in $1
else echo Using defaults
ENOUGH=1000000
TIMING_O=0
LOOP_O=0
fi
export ENOUGH TIMING_O LOOP_O
if [ X$FILE = X ]
then
FILE=/tmp/XXX
touch $FILE || echo Can not create $FILE
fi
if [ X$MB = X ]
then
MB=8
fi
AVAILKB=`expr $MB \* 1024`
# Figure out how big we can go for stuff that wants to use
# all and half of memory.
HALF="512 1k 2k 4k 8k 16k 32k 64k 128k 256k 512k 1m"
ALL="$HALF 2m"
i=4
while [ $i -le $MB ]
do
ALL="$ALL ${i}m"
h=`expr $i / 2`
HALF="$HALF ${h}m"
i=`expr $i \* 2`
done
if [ X$FSDIR = X ]
then
FSDIR=/tmp/lat_fs
fi
MP=N
# Figure out as much stuff as we can about this system.
# Sure would be nice if everyone had SGI's "hinv".
echo \[lmbench2.0 results for `uname -a`] 1>&2
echo \[ALL: ${ALL}] 1>&2
echo \[DISKS: ${DISKS}] 1>&2
echo \[DISK_DESC: ${DISK_DESC}] 1>&2
echo \[ENOUGH: ${ENOUGH}] 1>&2
echo \[FAST: ${FAST}] 1>&2
echo \[FASTMEM: ${FASTMEM}] 1>&2
echo \[FILE: ${FILE}] 1>&2
echo \[FSDIR: ${FSDIR}] 1>&2
echo \[HALF: ${HALF}] 1>&2
echo \[INFO: ${INFO}] 1>&2
echo \[LOOP_O: ${LOOP_O}] 1>&2
echo \[MB: ${MB}] 1>&2
echo \[MHZ: ${MHZ}] 1>&2
echo \[MOTHERBOARD: ${MOTHERBOARD}] 1>&2
echo \[NETrunS: ${NETrunS}] 1>&2
echo \[PROCESSORS: ${PROCESSORS}] 1>&2
echo \[REMOTE: ${REMOTE}] 1>&2
echo \[SLOWFS: ${SLOWFS}] 1>&2
echo \[OS: ${OS}] 1>&2
echo \[TIMING_O: ${TIMING_O}] 1>&2
echo \[LMBENCH VERSION: ${VERSION}] 1>&2
echo \[USER: $USER] 1>&2
echo \[HOSTNAME: `hostname`] 1>&2
echo \[NODENAME: `uname -n`] 1>&2
echo \[SYSNAME: `uname -s`] 1>&2
echo \[PROCESSOR: `uname -p`] 1>&2
echo \[MACHINE: `uname -m`] 1>&2
echo \[RELEASE: `uname -r`] 1>&2
echo \[VERSION: `uname -v`] 1>&2
#if 0
echo \[`date`] 1>&2
echo \[`uptime`] 1>&2
netstat -i | while read i
do
echo \[net: "$i"] 1>&2
set `echo $i`
case $1 in
*ame) ;;
*) ifconfig $1 | while read i
do
echo \[if: "$i"] 1>&2
done
;;
esac
done
mount | while read i
do
echo \[mount: "$i"] 1>&2
done
STAT=$FSDIR/lmbench
mkdir $FSDIR 2>/dev/null
touch $STAT 2>/dev/null
if [ ! -f $STAT ]
then
echo "Can't make a file - $STAT - in $FSDIR"
touch $STAT
exit 1
fi
if [ ! -f "/tmp/hello" ]
then
cp hello /tmp/hello
fi
function run {
echo "$@"
TMPOUT=/tmp/OUT
rm -rf $TMPOUT
$LOADER "$@" 2>>$TMPOUT | tee -a $TMPOUT
retval=$?
echo $retval
if [ $retval -ne 0 ]
then
cat $TMPOUT 1>&2
exit $retval
else
cat $TMPOUT 1>&2
fi
}
function af_unix {
# DP 7/4/18: This test intermittently hangs on SGX, taking out of CI for now
#AF_UNIX
echo AF_UNIX socket latency
for i in `seq 1 $N_RUNS`
do
run lat_unix
done
}
function wr_bw {
for i in `seq 1 $N_RUNS`
do
rm -f $FILE
run lmdd label="File $FILE write bandwidth:" of=$FILE move=${MB}m fsync=1 print=3
done
}
function udp_soc_lat {
echo UDP socket latency
run lat_udp -s &
sleep 3
for i in `seq 1 $N_RUNS`
do
run lat_udp 127.0.0.1
sleep 1
done
run lat_udp -127.0.0.1
sleep 3
}
function tcp_soc_lat {
echo TCP socket latency
run lat_tcp -s &
sleep 3
for i in `seq 1 $N_RUNS`
do
run lat_tcp 127.0.0.1
sleep 1
done
run lat_tcp -127.0.0.1
sleep 3
}
function tcp_con_lat {
echo TCP connect latency
run lat_connect -s &
sleep 3
run lat_connect 127.0.0.1
sleep 1
run lat_connect -127.0.0.1
sleep 3
}
function tcp_soc_bw {
echo TCP socket bandwidth
run bw_tcp -s &
sleep 3
for i in `seq 1 $N_RUNS`
do
run bw_tcp 127.0.0.1
sleep 1
done
run bw_tcp -127.0.0.1
sleep 3
}
function bw_unix {
for i in `seq 1 $N_RUNS`
do
run bw_unix
done
}
function bw_pipe {
for i in `seq 1 $N_RUNS`
do
run bw_pipe
done
}
declare -a tests=(
"lat_syscall null"
"lat_syscall read"
"lat_syscall write"
"lat_syscall stat $STAT"
"lat_syscall fstat $STAT"
"lat_syscall open $STAT"
"lat_select file 500"
# DP 1/20/18: This test intermittently hangs on SGX, taking out of CI for now
# "lat_select tcp 500"
"lat_sig install"
"lat_sig catch"
"lat_sig prot lat_sig"
## DEP 2/4/19: Temporarily remove fork from the unit tests
# "lat_proc fork"
## DEP 6/16/18: Temporarily remove dfork from the unit tests
# "lat_proc dfork"
## DEP 12/9/17: Temporarily remove vfork from the unit tests
# "lat_proc vfork"
## DEP 11/1/18: Temporarily remove exec from the unit tests
# "lat_proc exec"
## DEP 6/19/18: Temporarily remove dforkexec from the unit tests
# "lat_proc dforkexec"
## DEP 6/16/18: Temporarily remove shell from the unit tests
# "lat_proc shell"
"lat_fs $FSDIR"
);
declare -a test_funcs=(
# DP 7/4/18: This test intermittently hangs on SGX, taking out of CI for now
# "af_unix"
"wr_bw"
"udp_soc_lat"
"tcp_soc_lat"
"tcp_con_lat"
"tcp_soc_bw"
"bw_unix"
## DEP 1/20/18: Temporarliy remove bw_pipe from the unit tests - intermittent hangs
# "bw_pipe"
);
date
echo Latency measurements
msleep 250
for i in `seq 0 $((${#tests[@]}-1))`
do
echo "Running ${tests[$i]}"
run ${tests[$i]}
done
for i in `seq 0 $((${#test_funcs[@]}-1))`
do
echo "Calling ${test_funcs[$i]}"
${test_funcs[$i]}
done
exit 0