run_aot.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. SHOOTOUT_CASES="base64 fib2 gimli heapsort matrix memmove nestedloop \
  12. nestedloop2 nestedloop3 random seqhash sieve strchr \
  13. switch2"
  14. rm -f $REPORT
  15. touch $REPORT
  16. function print_bench_name()
  17. {
  18. name=$1
  19. echo -en "$name" >> $REPORT
  20. name_len=${#name}
  21. if [ $name_len -lt $BENCH_NAME_MAX_LEN ]
  22. then
  23. spaces=$(( $BENCH_NAME_MAX_LEN - $name_len ))
  24. for i in $(eval echo "{1..$spaces}"); do echo -n " " >> $REPORT; done
  25. fi
  26. }
  27. echo "Start to run cases, the result is written to report.txt"
  28. #run benchmarks
  29. cd $OUT_DIR
  30. if [[ ${PLATFORM} == "linux" ]]; then
  31. echo -en "\t\t\t\t\t native\tiwasm-aot\tiwasm-aot-segue\n" >> $REPORT
  32. else
  33. echo -en "\t\t\t\t\t native\tiwasm-aot\n" >> $REPORT
  34. fi
  35. for t in $SHOOTOUT_CASES
  36. do
  37. print_bench_name $t
  38. echo "run $t with native .."
  39. echo -en "\t" >> $REPORT
  40. $TIME -f "real-%e-time" ./${t}_native 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT
  41. echo "run $t with iwasm aot .."
  42. echo -en "\t" >> $REPORT
  43. $TIME -f "real-%e-time" $IWASM_CMD ${t}.aot 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT
  44. if [[ ${PLATFORM} == "linux" ]]; then
  45. echo "run $t with iwasm aot segue .."
  46. echo -en "\t" >> $REPORT
  47. $TIME -f "real-%e-time" $IWASM_CMD ${t}_segue.aot 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT
  48. fi
  49. echo -en "\n" >> $REPORT
  50. done