trace-boot 1.1 KB

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env bash
  2. . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
  3. while getopts "${common_getopts_flags}" OPT; do
  4. case "$OPT" in
  5. ?)
  6. common_getopts_case "$OPT"
  7. ;;
  8. esac
  9. done
  10. shift "$(($OPTIND - 1))"
  11. common_setup
  12. if "$common_gem5"; then
  13. time ./run -a "$common_arch" -E 'm5 exit' -g -T 'Exec,-ExecSymbol,-ExecMicro' "$@"
  14. else
  15. time ./run -a "$common_arch" -e 'init=/poweroff.out' -T exec_tb "$@"
  16. time ./qemu-trace2txt -a "$common_arch"
  17. # Instruction count.
  18. # We could put this on a separate script, but it just adds more arch boilerplate to a new script.
  19. # So let's just leave it here for now since it did not add a significant processing time.
  20. echo "instructions $(wc -l "${common_trace_txt_file}" | cut -d' ' -f1)"
  21. entry_addr=$("${common_root_dir}/runtc" readelf -h "${common_build_dir}/linux-custom/vmlinux" | grep 'Entry point address' | sed -E 's/.*: *//')
  22. echo "entry_address ${entry_addr}"
  23. sed "/${entry_addr}/q" "${common_trace_txt_file}" >"${common_qemu_run_dir}/trace-boot.txt"
  24. echo "instructions_firmware $(wc -l "${common_qemu_run_dir}/trace-boot.txt" | cut -d' ' -f1)"
  25. fi