-
Notifications
You must be signed in to change notification settings - Fork 14
/
pte_mgr.sh
executable file
·93 lines (77 loc) · 1.67 KB
/
pte_mgr.sh
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
#!/bin/bash
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
#
# usage: ./pte_mgr.sh <PTE Mgr input file>
# example: ./pte_mgr.sh PTEMgr.txt
# example: ./pte_mgr.sh PTEMgr.txt 1507234227470
#
# PTEMgr.txt:
# driver=pte userInputs/runCases-constant-i.txt
# driver=pte userInputs/runCases-constant-q.txt
#
inFile=$1
EXEPTE=pte_driver.sh
nPTE=0
tStart=0
PIDS=""
echo "num $#"
if [ $# -gt 1 ]; then
tStart=$2
fi
while read line
do
#echo $line
tt=$(echo $line | awk '{print $1}')
#echo " tt $tt"
driverType=$(echo $tt | awk '{print tolower($tt)}')
#echo "tt $tt driverType $driverType"
userinput=$(echo $line | awk '{print $2}')
case $driverType in
driver=pte)
echo "driver type supported: $driverType"
pteArray[${#pteArray[@]}]=$userinput
;;
*)
echo "driver type unknown: $driverType"
;;
esac
done < $1
echo "PTE Array: ${pteArray[@]}"
# PTE requests
function pteProc {
nPTE=${#pteArray[@]}
if [ $tStart -eq 0 ]; then
tWait=$[nPTE*4000+10000]
tCurr=`date +%s%N | cut -b1-13`
tStart=$[tCurr+tWait]
fi
echo "nPTE: $nPTE, tStart: $tStart"
iPTE=0
for i in ${pteArray[@]}; do
echo "./$EXEPTE $i $iPTE $tStart &"
./$EXEPTE $i $iPTE $tStart &
PIDS="$PIDS $!"
let iPTE+=1
done
}
# PTE
if [ ${#pteArray[@]} -gt 0 ]; then
echo "executing ${#pteArray[@]} PTE requests"
pteProc
else
echo "no PTE requests"
fi
# wait for pte_driver.sh to complete
RET=0
for p in $PIDS; do
wait $p
# return the error code of the process failed last if any
if [ $? -ne 0 ]; then
RET=$?
fi
done
exit $RET