-
Notifications
You must be signed in to change notification settings - Fork 3
/
cyclictest-server-start
executable file
·85 lines (74 loc) · 2.13 KB
/
cyclictest-server-start
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
#!/bin/bash
exec >cyclictest-server-start.txt
exec 2>&1
. /usr/bin/cyclictest-base || (echo "/usr/bin/cyclictest-base not found"; exit 1)
STRESS_NG_TILES_PER_CPU=1
opts=$(getopt -q -o "" --longoptions "stress-ng-tiles-per-cpu:" -n "getopt.sh" -- "$@");
if [ $? -ne 0 ]; then
printf -- "\tUnrecognized option specified\n\n"
exit 1
fi
eval set -- "$opts";
while true; do
case "$1" in
--stress-ng-tiles-per-cpu)
shift;
STRESS_NG_TILES_PER_CPU=$1
shift;
;;
--)
shift;
break
;;
*)
echo "Invalid option: $1"
exit 1
esac
done
if [ -z "$WORKLOAD_CPUS" -a -z "$HK_CPUS" ]; then
TMP_CPUS=$(grep Cpus_allowed_list /proc/self/status | awk '{ print $2 }')
echo "CPUs Allowed List: ${TMP_CPUS}"
CPUS=""
for sequence in $(echo ${TMP_CPUS} | sed -e 's/,/ /g'); do
if echo $sequence | grep -q '-'; then
start=$(echo $sequence | awk -F- '{ print $1 }')
stop=$(echo $sequence | awk -F- '{ print $2 }')
CPUS+=" $(seq $start 1 $stop) "
else
CPUS+=" $sequence "
fi
done
CPUS=$(echo "${CPUS}" | sed -z 's/\n/ /g' | sed -e 's/\s\+/,/g' -e 's/^,//' -e 's/,$//')
else
echo "HK_CPUS: $HK_CPUS"
echo "WORKLOAD_CPUS: $WORKLOAD_CPUS"
echo "Current script affinity:"
taskset -c -p $$
CPUS="${HK_CPUS},${WORKLOAD_CPUS}"
fi
echo "STRESS_NG_TILES_PER_CPU=${STRESS_NG_TILES_PER_CPU}"
echo "CPUS: ${CPUS}"
NUM_CPUS=$(echo "${CPUS}" | sed -e "s/,/ /g" | wc -w)
echo "NUM_CPUS=${NUM_CPUS}"
TEST_TILES=$(( ${NUM_CPUS} * ${STRESS_NG_TILES_PER_CPU} ))
echo "TEST_TILES: ${TEST_TILES}"
CMD="taskset -c ${CPUS}"
CMD+=" stress-ng"
CMD+=" --cpu ${TEST_TILES}"
CMD+=" --hdd ${TEST_TILES}"
CMD+=" --io ${TEST_TILES}"
CMD+=" --malloc ${TEST_TILES}"
CMD+=" --mmap ${TEST_TILES}"
CMD+=" --msg ${TEST_TILES}"
CMD+=" --stream ${TEST_TILES}"
CMD+=" --sysinfo ${TEST_TILES}"
CMD+=" --vm ${TEST_TILES}"
CMD+=" --timeout 0"
CMD+=" --metrics"
CMD+=" --times"
CMD+=" --verbose"
echo "About to run: ${CMD}"
${CMD} > stress-ng.out 2>&1 &
pid=$!
echo "stress-ng PID is ${pid}"
echo ${pid} > stress-ng.pid