common 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/env bash
  2. common_abspath() (
  3. echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
  4. )
  5. common_bench_cmd() (
  6. # Benchmark a command.
  7. #
  8. # $1: command to benchmark
  9. # $2: where to write results to
  10. #
  11. # Result format:
  12. #
  13. # cmd <command run>
  14. # time <time in seconds to finish>
  15. # status <exit status>
  16. cmd="$1"
  17. results_file="$2"
  18. printf 'cmd ' >> "$results_file"
  19. env time --append -f 'time %e' --output="$results_file" ./eeval -a "$cmd" "$results_file"
  20. printf "status $?\n" >> "$results_file"
  21. )
  22. set_common_vars() {
  23. arch="$1"
  24. gem5="${2:-false}"
  25. buildroot_dir="${root_dir}/buildroot"
  26. arch_dir="$arch"
  27. if "$gem5" && [ ! "$arch" = aarch64 ]; then
  28. arch_dir="${arch}-gem5"
  29. fi
  30. out_arch_dir="${out_dir}/${arch_dir}"
  31. buildroot_out_dir="${out_arch_dir}/buildroot"
  32. build_dir="${buildroot_out_dir}/build"
  33. images_dir="${buildroot_out_dir}/images"
  34. host_dir="${buildroot_out_dir}/host"
  35. gem5_out_dir="${out_arch_dir}/gem5"
  36. m5out_dir="${gem5_out_dir}/m5out"
  37. qemu_out_dir="${out_arch_dir}/qemu"
  38. qemu_trace_txt_file="${qemu_out_dir}/trace.txt"
  39. }
  40. root_dir="$(pwd)"
  41. out_dir="${root_dir}/out"
  42. data_dir="${root_dir}/data"
  43. p9_dir="${data_dir}/9p"
  44. readfile_file="${data_dir}/readfile"
  45. common_dir="${out_dir}/common"
  46. f="${data_dir}/cli"
  47. if [ -f "$f" ]; then
  48. . "$f"
  49. fi
  50. # Default arch.
  51. arch=x86_64