3 # Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 MY_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
19 function get_result_of_benchmark_test()
26 $MY_PATH/models/run_test.sh --driverbin="$DRIVER_BIN -r 5 -w 3" $MODEL > $LOG_FILE 2>&1
28 if [[ $RET -ne 0 ]]; then
29 echo "Testing $MODEL aborted... exit code: $RET"
33 local RESULT=`grep -E '^- MEAN ' $LOG_FILE | awk '{print $4}'`
37 function print_result_of_benchmark_test()
43 echo "$NAME $RESULT" > $RESULT_FILE
46 function print_with_dots()
50 pad=$(printf '%0.1s' "."{1..45})
51 padlength=$((PRINT_WIDTH- ${#MSG}))
53 printf '%*.*s ' 0 $padlength "$pad"
57 function run_benchmark_and_print()
59 local WRITE_FILE_NAME=$1
62 local REPORT_MODEL_DIR=$4
63 local PAUSE_TIME_IN_SEC=$5
65 local BENCHMARK_RUN_TEST_SH=$7
67 LOG_FILE=$REPORT_MODEL_DIR/$WRITE_FILE_NAME.txt
68 RESULT_FILE=$REPORT_MODEL_DIR/$WRITE_FILE_NAME.result
70 RESULT=$(get_result_of_benchmark_test $DRIVER_BIN $MODEL $LOG_FILE)
72 print_result_of_benchmark_test "$MSG" "$RESULT" $RESULT_FILE
73 sleep $PAUSE_TIME_IN_SEC