-
Notifications
You must be signed in to change notification settings - Fork 4
/
hwlatdetect-client
executable file
·54 lines (47 loc) · 1.04 KB
/
hwlatdetect-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
#!/bin/bash
exec >hwlatdetect-client-stderrout.txt
exec 2>&1
. /usr/bin/hwlatdetect-base || (echo "/usr/bin/hwlatdetect-base not found"; exit 1)
dump_runtime
validate_label
validate_sw_prereqs
# defaults
duration=60
threshold=1us
longopts="duration:,threshold:"
opts=$(getopt -q -o "d:t:" --longoptions "$longopts" -n "getopt.sh" -- "$@");
eval set -- "$opts";
while true; do
case "$1" in
-d|--duration)
shift
duration=$1
shift
;;
-t|--threshold)
shift
threshold=$1
shift
;;
--)
shift;
break
;;
*)
shift
;;
esac
done
cmd="hwlatdetect --duration=${duration} --threshold=${threshold}"
echo "About to run: $cmd"
date +%s.%N >begin.txt
$cmd >hwlatdetect-bin-stderrout.txt 2>&1
date +%s.%N >end.txt
if grep -q "test finished" hwlatdetect-bin-stderrout.txt; then
rc=0
else
rc=1
fi
if [ $rc -gt 0 ]; then
exit_error "`cat hwlatdetect-bin-stderrout.txt`"
fi