125
125
}
126
126
127
127
print_result_tsv_header () {
128
- printf " Test name\tTest warmup\tTest iterations\tTest requests\tPHP\tPHP Commit hash\tPHP Commit URL\tMin\tMax\tStd dev\tAverage\tAverage diff %%\tMedian\tMedian diff %%\tInstruction count\n\tMemory usage\n" >> " $1 .tsv"
128
+ if [ " $INFRA_INSTRUCTION_COUNT " == " 1" ]; then
129
+ instruction_count_header_name=" \tInstruction count"
130
+ else
131
+ instruction_count_header_name=" "
132
+ fi
133
+
134
+ printf " Test name\tTest warmup\tTest iterations\tTest requests\tPHP\tPHP Commit hash\tPHP Commit URL\tMin\tMax\tStd dev\tAverage\tAverage diff %%\tMedian\tMedian diff %%$instruction_count_header_name \tMemory usage\n" >> " $1 .tsv"
129
135
}
130
136
131
137
print_result_md_header () {
@@ -134,11 +140,19 @@ print_result_md_header () {
134
140
description=" $description , $TEST_REQUESTS requests"
135
141
fi
136
142
143
+ if [ " $INFRA_INSTRUCTION_COUNT " == " 1" ]; then
144
+ instruction_count_header_name=" | Instr count "
145
+ instruction_count_header_separator=" |---------------" ;
146
+ else
147
+ instruction_count_header_name=" "
148
+ instruction_count_header_separator=" " ;
149
+ fi
150
+
137
151
cat << EOF >> "$1 .md"
138
152
### $TEST_NAME - $description (sec)
139
153
140
- | PHP | Min | Max | Std dev | Average | Average diff % | Median | Median diff % | Instr count | Memory |
141
- |-------------|-------------|-------------|--------------|------------|-----------------|------------|---------------|--------------- |---------------|
154
+ | PHP | Min | Max | Std dev | Average | Average diff % | Median | Median diff % $instruction_count_header_name | Memory |
155
+ |-------------|-------------|-------------|--------------|------------|-----------------|------------|---------------$instruction_count_header_separator |---------------|
142
156
EOF
143
157
}
144
158
@@ -148,7 +162,15 @@ print_result_value () {
148
162
url=" ${PHP_REPO// .git/ } /commit/$commit_hash "
149
163
150
164
results=" $( cat " $1 " ) "
151
- instruction_count=" $( cat " $2 " ) "
165
+ if [ " $INFRA_INSTRUCTION_COUNT " == " 1" ]; then
166
+ instruction_count_tsv_format=" \t%d"
167
+ instruction_count_md_format=" |%d"
168
+ instruction_count=" $( cat " $2 " ) "
169
+ else
170
+ instruction_count_tsv_format=" %s"
171
+ instruction_count_md_format=" %s"
172
+ instruction_count=" "
173
+ fi
152
174
memory_result=" $( cat " $3 " ) "
153
175
154
176
min=" $( min " $results " ) "
@@ -166,13 +188,13 @@ print_result_value () {
166
188
std_dev=" $( std_deviation " $results " ) "
167
189
memory_usage=" $( echo " scale=3;${memory_result} /1024" | bc -l) "
168
190
169
- printf " %s\t%d\t%d\t%d\t%s\t%s\t%s\t%.5f\t%.5f\t%.5f\t%.5f\t%.2f\t%.5f\t%.2f\t%d \t%.2f\n" \
191
+ printf " %s\t%d\t%d\t%d\t%s\t%s\t%s\t%.5f\t%.5f\t%.5f\t%.5f\t%.2f\t%.5f\t%.2f$instruction_count_tsv_format \t%.2f\n" \
170
192
" $TEST_NAME " " $TEST_WARMUP " " $TEST_ITERATIONS " " $TEST_REQUESTS " \
171
193
" $PHP_NAME " " $commit_hash " " $url " \
172
194
" $min " " $max " " $std_dev " " $average " " $average_diff " " $median " " $median_diff " " $instruction_count " " $memory_usage " >> " $4 .tsv"
173
195
174
196
if [ " $5 " -eq " 1" ]; then
175
- printf " |[%s]($url )|%.5f|%.5f|%.5f|%.5f|%.2f%%|%.5f|%.2f%%|%d |%.2f MB|\n" \
197
+ printf " |[%s]($url )|%.5f|%.5f|%.5f|%.5f|%.2f%%|%.5f|%.2f%%$instruction_count_md_format |%.2f MB|\n" \
176
198
" $PHP_NAME " " $min " " $max " " $std_dev " " $average " " $average_diff " " $median " " $median_diff " " $instruction_count " " $memory_usage " >> " $4 .md"
177
199
fi
178
200
}
@@ -258,13 +280,17 @@ format_memory_log_file() {
258
280
run_real_benchmark () {
259
281
# Benchmark
260
282
run_cgi " verbose" " 0" " 1" " $1 " " $2 " " $3 "
261
- run_cgi " instruction_count" " 10" " 10" " $1 " " $2 " " $3 " 2>&1 | tee -a " $instruction_count_log_file "
283
+ if [ " $INFRA_INSTRUCTION_COUNT " == " 1" ]; then
284
+ run_cgi " instruction_count" " 10" " 10" " $1 " " $2 " " $3 " 2>&1 | tee -a " $instruction_count_log_file "
285
+ fi
262
286
run_cgi " memory" " $TEST_WARMUP " " $TEST_REQUESTS " " $1 " " $2 " " $3 " 2>&1 | tee -a " $memory_log_file "
263
287
for b in $( seq $TEST_ITERATIONS ) ; do
264
288
run_cgi " quiet" " $TEST_WARMUP " " $TEST_REQUESTS " " $1 " " $2 " " $3 " 2>&1 | tee -a " $log_file "
265
289
done
266
290
267
- format_instruction_count_log_file " $instruction_count_log_file "
291
+ if [ " $INFRA_INSTRUCTION_COUNT " == " 1" ]; then
292
+ format_instruction_count_log_file " $instruction_count_log_file "
293
+ fi
268
294
format_memory_log_file " $memory_log_file "
269
295
270
296
# Format log
@@ -276,11 +302,15 @@ run_real_benchmark () {
276
302
277
303
run_micro_benchmark () {
278
304
# Benchmark
279
- run_cgi " instruction_count" " 2" " 2" " $1 " " " " " 2>&1 | tee -a " $instruction_count_log_file "
305
+ if [ " $INFRA_INSTRUCTION_COUNT " == " 1" ]; then
306
+ run_cgi " instruction_count" " 2" " 2" " $1 " " " " " 2>&1 | tee -a " $instruction_count_log_file "
307
+ fi
280
308
run_cgi " memory" " 0" " $TEST_WARMUP " " $1 " " " " " 2>&1 | tee -a " $memory_log_file "
281
309
run_cgi " normal" " $TEST_WARMUP " " $TEST_ITERATIONS " " $1 " " " " " 2>&1 | tee -a " $log_file "
282
310
283
- format_instruction_count_log_file " $instruction_count_log_file "
311
+ if [ " $INFRA_INSTRUCTION_COUNT " == " 1" ]; then
312
+ format_instruction_count_log_file " $instruction_count_log_file "
313
+ fi
284
314
format_memory_log_file " $memory_log_file "
285
315
286
316
# Format log
0 commit comments