gem5-bench-dhrystone 1.1 KB

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bash
  2. # https://cirosantilli.com/linux-kernel-module-cheat#gem5-run-benchmark
  3. set -eu
  4. root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
  5. outfile="${root_dir}/out/gem5-bench-dhrystone.txt"
  6. arch=aarch64
  7. cmd="./run --arch '$arch' --emulator gem5 --eval-after './gem5.sh'"
  8. # These cache sizes roughly match the ARM Cortex A75
  9. # https://en.wikipedia.org/wiki/ARM_Cortex-A75
  10. restore='--gem5-restore 1 -- --cpu-type=HPI --restore-with-cpu=HPI --caches --l2cache --l1d_size=64kB --l1i_size=64kB --l2_size=256kB'
  11. # Generate a checkpoint after Linux boots, using the faster and less detailed CPU.
  12. # The boot takes a while, be patient young Padawan.
  13. eval "$cmd"
  14. printf 'n cycles\n' > "$outfile"
  15. for n in 1000 10000 100000; do
  16. # Restore the most recent checkpoint taken with the more detailed and slower HPI CPU,
  17. # and run the benchmark with different parameters. We skip the boot completely, saving time!
  18. eval "${cmd} --gem5-readfile 'm5 resetstats;dhrystone ${n};m5 dumpstats' ${restore}" &>/dev/null
  19. printf "${n} " >> "$outfile"
  20. ./gem5-stat --arch "$arch" | head -n 1 >> "$outfile"
  21. done