run_aot.sh 1.7 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. PLATFORM=$(uname -s | tr A-Z a-z)
  5. CUR_DIR=$PWD
  6. OUT_DIR=$CUR_DIR/out
  7. REPORT=$CUR_DIR/report.txt
  8. TIME=/usr/bin/time
  9. PLATFORM=$(uname -s | tr A-Z a-z)
  10. IWASM_CMD=$CUR_DIR/../../../product-mini/platforms/${PLATFORM}/build/iwasm
  11. BENCH_NAME_MAX_LEN=20
  12. JETSTREAM_CASES="gcc-loops HashSet tsf float-mm quicksort"
  13. rm -f $REPORT
  14. touch $REPORT
  15. function print_bench_name()
  16. {
  17. name=$1
  18. echo -en "$name" >> $REPORT
  19. name_len=${#name}
  20. if [ $name_len -lt $BENCH_NAME_MAX_LEN ]
  21. then
  22. spaces=$(( $BENCH_NAME_MAX_LEN - $name_len ))
  23. for i in $(eval echo "{1..$spaces}"); do echo -n " " >> $REPORT; done
  24. fi
  25. }
  26. echo "Start to run cases, the result is written to report.txt"
  27. #run benchmarks
  28. cd $OUT_DIR
  29. if [[ ${PLATFORM} == "linux" ]]; then
  30. echo -en "\t\t\t\t\t native\tiwasm-aot\tiwasm-aot-segue\n" >> $REPORT
  31. else
  32. echo -en "\t\t\t\t\t native\tiwasm-aot\n" >> $REPORT
  33. fi
  34. for t in $JETSTREAM_CASES
  35. do
  36. print_bench_name $t
  37. echo "run $t with native .."
  38. echo -en "\t" >> $REPORT
  39. $TIME -f "real-%e-time" ./${t}_native 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT
  40. echo "run $t with iwasm aot .."
  41. echo -en "\t" >> $REPORT
  42. $TIME -f "real-%e-time" $IWASM_CMD --dir=. ${t}.aot 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT
  43. if [[ ${PLATFORM} == "linux" ]]; then
  44. echo "run $t with iwasm aot segue .."
  45. echo -en "\t" >> $REPORT
  46. $TIME -f "real-%e-time" $IWASM_CMD --dir=. ${t}_segue.aot 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT
  47. fi
  48. echo -en "\n" >> $REPORT
  49. done