-
Notifications
You must be signed in to change notification settings - Fork 3
/
cyclictest-client
executable file
·143 lines (128 loc) · 3.28 KB
/
cyclictest-client
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
#!/bin/bash
exec >cyclictest-client-stderrout.txt
exec 2>&1
. /usr/bin/cyclictest-base || (echo "/usr/bin/cyclictest-base not found"; exit 1)
dump_runtime
validate_label
validate_sw_prereqs
if [ -z "$WORKLOAD_CPUS" ]; then
exit_error "WORKLOAD_CPUS is not defined. This must be defined to run cyclictest"
else
echo "WORKLOAD_CPUS: $WORKLOAD_CPUS"
fi
if [ -z "$HK_CPUS" ]; then
exit_error "HK_CPUS is not defined. This must be defined to run cyclictest"
else
echo "HK_CPUS: $HK_CPUS"
fi
# defaults
duration=60
policy=fifo
interval=100
smt="on"
break_on=0
smi="on"
longopts="duration:,priority:,policy:,interval:,smt:,break-on:,smi:"
opts=$(getopt -q -o "D:p:i:s:b:" --longoptions "$longopts" -n "getopt.sh" -- "$@");
eval set -- "$opts";
while true; do
case "$1" in
--smi)
shift
smi=$1
shift
;;
-D|--duration)
shift
duration=$1
shift
;;
-p|--priority)
shift
priority=$1
shift
;;
--policy)
shift
policy=$1
shift
;;
-i|--interval)
shift
interval=$1
shift
;;
-s|--smt)
shift
smt=$1
shift
;;
-b|--break-on)
shift
break_on=$1
shift
;;
--)
shift;
break
;;
*)
shift
;;
esac
done
# adjust CPUs to use
cpu_str=""
for cpu in $(echo $WORKLOAD_CPUS | sed -e "s/,/ /g"); do
cpu_str+=" --cpu $cpu"
done
cmd="${TOOLBOX_HOME}/bin/get-cpus-ordered.py --smt ${smt} ${cpu_str}"
echo "about to run: ${cmd}"
CMD_OUTPUT=$(${cmd})
echo -e "${CMD_OUTPUT}"
WORKLOAD_CPUS=$(echo -e "${CMD_OUTPUT}" | grep "final cpus:" | awk '{ print $3 }')
echo "WORKLOAD_CPUS: ${WORKLOAD_CPUS}"
WORKLOAD_CPUS_COUNT=$(echo -e "${CMD_OUTPUT}" | grep "final cpus count:" | awk '{ print $4 }')
echo "WORKLOAD_CPUS_COUNT: ${WORKLOAD_CPUS_COUNT}"
cpu_str=""
for cpu in $(echo $HK_CPUS | sed -e "s/,/ /g"); do
cpu_str+=" --cpu $cpu"
done
cmd="${TOOLBOX_HOME}/bin/get-cpus-ordered.py --smt ${smt} ${cpu_str}"
echo "about to run: ${cmd}"
CMD_OUTPUT=$(${cmd})
echo -e "${CMD_OUTPUT}"
HK_CPUS=$(echo -e "${CMD_OUTPUT}" | grep "final cpus:" | awk '{ print $3 }')
echo "HK_CPUS: ${HK_CPUS}"
HK_CPUS_COUNT=$(echo -e "${CMD_OUTPUT}" | grep "final cpus count:" | awk '{ print $4 }')
echo "HK_CPUS_COUNT: ${HK_CPUS_COUNT}"
prio=""
if [ -n "${priority}" ]; then
prio="--priority ${priority}"
fi
break=""
if [ ${break_on} -gt 0 ]; then
break="--breaktrace=${break_on}"
fi
validate_clocksource
case "${smi}" in
on)
smi_arg="--smi"
;;
off)
smi_arg=""
;;
*)
exit_error "invalid --smi value [${smi}]"
;;
esac
cmd="taskset -c ${WORKLOAD_CPUS},${HK_CPUS} /usr/bin/cyclictest --policy $policy ${prio} --interval ${interval} --histofall 100 --histfile histogram.txt --duration ${duration} --quiet --affinity ${WORKLOAD_CPUS} --threads ${WORKLOAD_CPUS_COUNT} --mlockall --json cyclictest.json --mainaffinity ${HK_CPUS} ${smi_arg} ${break}"
echo "About to run: $cmd"
date +%s.%N >begin.txt
$cmd >cyclictest-bin-stderrout.txt 2>&1
rc=$?
date +%s.%N >end.txt
validate_clocksource
if [ $rc -gt 0 ]; then
exit_error "`cat cyclictest-bin-stderrout.txt`"
fi