@@ -34,6 +34,12 @@ declare INPUT_ARGS="${DEFAULT_INPUT_ARGS}"
34
34
declare -r DEFAULT_OUTPUT_FILE=" "
35
35
declare OUTPUT_FILE=" ${DEFAULT_OUTPUT_FILE} "
36
36
37
+ declare -r -i DEFAULT_RUNS=1
38
+ declare -i RUNS=${DEFAULT_RUNS}
39
+
40
+ declare -r -i DEFAULT_TOTAL_INVOCATIONS=0
41
+ declare -i TOTAL_INVOCATIONS=${DEFAULT_TOTAL_INVOCATIONS}
42
+
37
43
function usage() {
38
44
local exitval=${1-1}
39
45
cat & > /dev/stderr << USAGE
44
50
--burst-size <range> number of RPCs within a burst. Default: ${DEFAULT_BURST_SIZE} .
45
51
--num-workers <range> number of workers to execute, as an integer or a range (min:increment:max or min:max). Default: ${DEFAULT_NUM_WORKERS} .
46
52
--num-qps <range> queries per second, as an integer or a range (min:increment:max or min:max). Default: ${DEFAULT_QPS} .
53
+ --runs <int> number of times to run each configuration. Default: ${DEFAULT_RUNS} .
54
+ --total-invocations <int> total number of invocations to execute. Default: ${DEFAULT_TOTAL_INVOCATIONS} .
47
55
--mode <string> traffic generator mode: 'byob' or 'v8'. Default: byob
48
56
--output-file <string> path to output JSON. Default: print to stdout.
49
57
@@ -74,6 +82,8 @@ while [[ $# -gt 0 ]]; do
74
82
--burst-size) BURST_SIZE=" $2 " ; shift 2 || usage 1 ;;
75
83
--num-workers) NUM_WORKERS=" $2 " ; shift 2 || usage 1 ;;
76
84
--num-qps) QPS=" $2 " ; shift 2 || usage 1 ;;
85
+ --runs) RUNS=$2 ; shift 2 || usage 1 ;;
86
+ --total-invocations) TOTAL_INVOCATIONS=$2 ; shift 2 || usage 1 ;;
77
87
--mode) MODE=" $2 " ; shift 2 || usage 1 ;;
78
88
79
89
--cpus) CPUS=$2 ; shift 2 || usage 1 ;;
@@ -108,7 +118,8 @@ function run_test() {
108
118
declare -r -i burst_size=$1 ; shift
109
119
declare -r -i qps=$1 ; shift
110
120
declare -r -i num_workers=$1 ; shift
111
- printf " running qps: %d\n" ${qps}
121
+ declare -r run_id=$1 ; shift
122
+ printf " running qps: %d with run_id: %s\n" ${qps} " ${run_id} "
112
123
113
124
declare -a CMD_ARGS=(
114
125
" --burst_size=${burst_size} "
@@ -117,6 +128,8 @@ function run_test() {
117
128
" --queries_per_second=${qps} "
118
129
" --mode=${MODE} "
119
130
" --output_file=${OUTPUT_FILE} "
131
+ " --total_invocations=${TOTAL_INVOCATIONS} "
132
+ " --run_id=${run_id} "
120
133
)
121
134
122
135
if [[ ${MODE} == v8 ]]; then
@@ -171,14 +184,18 @@ declare -a NUM_WORKERS_LIST=($(seq ${NUM_WORKERS//:/ }))
171
184
declare -a BURST_SIZE_LIST=($( seq ${BURST_SIZE//:/ } ) )
172
185
173
186
declare -i qps num_workers burst_size
187
+ declare BASE_RUN_ID
174
188
for qps in " ${QPS_LIST[@]} " ; do
175
189
for num_workers in " ${NUM_WORKERS_LIST[@]} " ; do
176
190
for burst_size in " ${BURST_SIZE_LIST[@]} " ; do
177
- run_test ${burst_size} ${qps} ${num_workers}
178
- if [[ ${FAILURE_COUNT} -ge ${MAX_FAILURES} ]]; then
179
- printf " %d failures. Exiting\n" ${FAILURE_COUNT}
180
- exit 1
181
- fi
191
+ BASE_RUN_ID=" $( mktemp --dry-run XXXX) "
192
+ for (( run= 1 ; run<= RUNS; run++ )) ; do
193
+ run_test ${burst_size} ${qps} ${num_workers} " ${BASE_RUN_ID} " -" ${run} "
194
+ if [[ ${FAILURE_COUNT} -ge ${MAX_FAILURES} ]]; then
195
+ printf " %d failures. Exiting\n" ${FAILURE_COUNT}
196
+ exit 1
197
+ fi
198
+ done
182
199
done
183
200
done
184
201
done
0 commit comments