run_aot.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. CUR_DIR=$PWD
  5. OUT_DIR=$CUR_DIR/out
  6. REPORT=$CUR_DIR/report.txt
  7. TIME=/usr/bin/time
  8. PLATFORM=$(uname -s | tr A-Z a-z)
  9. IWASM_CMD=$CUR_DIR/../../../product-mini/platforms/${PLATFORM}/build/iwasm
  10. BENCH_NAME_MAX_LEN=20
  11. JETSTREAM_CASES="gcc-loops quicksort HashSet float-mm"
  12. rm -f $REPORT
  13. touch $REPORT
  14. function print_bench_name()
  15. {
  16. name=$1
  17. echo -en "$name" >> $REPORT
  18. name_len=${#name}
  19. if [ $name_len -lt $BENCH_NAME_MAX_LEN ]
  20. then
  21. spaces=$(( $BENCH_NAME_MAX_LEN - $name_len ))
  22. for i in $(eval echo "{1..$spaces}"); do echo -n " " >> $REPORT; done
  23. fi
  24. }
  25. echo "Start to run cases, the result is written to report.txt"
  26. #run benchmarks
  27. cd $OUT_DIR
  28. echo -en "\t\t\t\t\t native\tiwasm-aot\n" >> $REPORT
  29. for t in $JETSTREAM_CASES
  30. do
  31. print_bench_name $t
  32. echo "run $t with native .."
  33. echo -en "\t" >> $REPORT
  34. $TIME -f "real-%e-time" ./${t}_native 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT
  35. echo "run $t with iwasm aot .."
  36. echo -en "\t" >> $REPORT
  37. $TIME -f "real-%e-time" $IWASM_CMD ${t}.aot 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT
  38. echo -en "\n" >> $REPORT
  39. done