-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathosnoise-client
executable file
·145 lines (130 loc) · 3.09 KB
/
osnoise-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
144
145
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4 -*-
# vim: autoindent tabstop=4 shiftwidth=4 expandtab softtabstop=4 filetype=bash
exec >osnoise-client-stderrout.txt
exec 2>&1
. /usr/bin/osnoise-base || (echo "/usr/bin/osnoise-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 osnoise"
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 osnoise"
else
echo "HK_CPUS: ${HK_CPUS}"
fi
no_load_balance=0
threshold=1
priority=""
duration=60
smt="on"
period=1000000
runtime=950000
opts=$(getopt -q -o "" --longoptions "cpus:,threshold:,priority:,no-load-balance:,duration:,smt:,period:,runtime:" -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
--cpus)
shift;
cpus=$1
shift;
;;
--threshold)
shift;
threshold=$1
shift;
;;
--priority)
shift;
priority="--priority $1"
shift;
;;
--duration)
shift;
duration=$1
shift;
;;
--smt)
shift
smt=$1
shift
;;
--period)
shift
period=$1
shift
;;
--runtime)
shift
runtime=$1
shift
;;
--no-load-balance)
shift;
no_load_balance=$1
shift;
;;
--)
shift;
break
;;
*)
echo "Invalid option: $1"
exit 1
esac
done
if [ "$no_load_balance" == "1" ]; then
disable_balance $cpus_list
fi
# 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}"
# Run on the workload cpus (exclude hk cpus by default)
if [ -z ${cpus} ]; then
cpus=${WORKLOAD_CPUS}
fi
echo
cmd="rtla osnoise --help"
echo "About to run: $cmd"
$cmd
echo
cmd="rtla osnoise --version"
echo "About to run: $cmd"
$cmd
echo
output=$(validate_clocksource)
if [ $? != 0 ]; then
exit_error "${output}"
fi
cmd="taskset -c ${WORKLOAD_CPUS} rtla osnoise top --quiet --duration ${duration}s --threshold ${threshold} --cpus ${WORKLOAD_CPUS} --period ${period} --runtime ${runtime} $priority"
echo "About to run: $cmd"
date +%s.%N >begin.txt
$cmd >osnoise-bin-stderrout.txt 2>&1
rc=$?
date +%s.%N >end.txt
output=$(validate_clocksource)
if [ $? != 0 ]; then
exit_error "${output}"
fi
if [ "$no_load_balance" == "1" ]; then
enable_balance $cpus_list
fi
if [ $rc -gt 0 ]; then
exit_error "`cat osnoise-bin-stderrout.txt`"
fi