From e936f8c154b5fc69f1b570864d66ac9ea17afe83 Mon Sep 17 00:00:00 2001 From: juncaipeng <52520497+juncaipeng@users.noreply.github.com> Date: Mon, 26 Aug 2019 21:41:20 +0800 Subject: [PATCH] modify benchmark.sh test=develop (#1871) --- lite/tools/benchmark.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lite/tools/benchmark.sh b/lite/tools/benchmark.sh index 8a48a16c73..1e3b840574 100644 --- a/lite/tools/benchmark.sh +++ b/lite/tools/benchmark.sh @@ -1,25 +1,25 @@ #!/bin/bash set -e -if [ $# -lt 2 ]; +if [ $# -lt 3 ]; then echo "Input error" echo "USAGE:" - echo " sh benchmark.sh benchmark_bin_path benchmark_models_path" - echo " sh benchmark.sh benchmark_bin_path benchmark_models_path is_run_model_optimize" + echo " sh benchmark.sh benchmark_bin_path benchmark_models_path result_filename" + echo " sh benchmark.sh benchmark_bin_path benchmark_models_path result_filename is_run_model_optimize" exit fi ANDROID_DIR=/data/local/tmp -RESULT_FILENAME="result.txt" WARMUP=10 REPEATS=30 BENCHMARK_BIN=$1 MODELS_DIR=$2 +RESULT_FILENAME=$3 IS_RUN_MODEL_OPTIMIZE=false -if [ $# -gt 2 ]; +if [ $# -gt 3 ]; then - IS_RUN_MODEL_OPTIMIZE=$3 + IS_RUN_MODEL_OPTIMIZE=$4 fi adb push $BENCHMARK_BIN $ANDROID_DIR/benchmark_bin @@ -32,9 +32,12 @@ do adb shell "echo Threads=$threads Warmup=$WARMUP Repeats=$REPEATS >> $ANDROID_DIR/$RESULT_FILENAME" for model_name in `ls $MODELS_DIR` do - echo $model_name + echo "Model=$model_name Threads=$threads" adb shell "$ANDROID_DIR/benchmark_bin --model_dir=$ANDROID_DIR/${MODELS_DIR##*/}/$model_name --warmup=$WARMUP --repeats=$REPEATS --threads=$threads --result_filename=$ANDROID_DIR/$RESULT_FILENAME --run_model_optimize=$IS_RUN_MODEL_OPTIMIZE" done adb shell "echo >> $ANDROID_DIR/$RESULT_FILENAME" done adb pull $ANDROID_DIR/$RESULT_FILENAME . +echo "\n--------------------------------------" +cat $RESULT_FILENAME +echo "--------------------------------------" -- GitLab