gem5-bench-dhrystone 1.1 KB

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bash
  2. # https://github.com/cirosantilli/linux-kernel-module-cheat/tree/58de3f7243016c052ad080f82dd757d61878219b#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 -a '$arch' --gem5 --eval-busybox '/gem5.sh'"
  8. # These cache sizes roughly match the ARM Cortex A75
  9. # https://en.wikipedia.org/wiki/ARM_Cortex-A75
  10. restore='-l 1 -- --cpu-type=HPI --restore-with-cpu=HPI --caches --l2cache --l1d_size=128kB --l1i_size=1024kB --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 'dhrystone ${n}' ${restore}" &>/dev/null
  19. printf "${n} " >> "$outfile"
  20. ./gem5-stat -a "$arch" >> "$outfile"
  21. done