gem5-stat 593 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bash
  2. . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
  3. common_gem5=true
  4. parsed=$(getopt -o "h${common_getopt_flags}" -l "$common_getopt_flags_long" -- "$@")
  5. eval set -- "$parsed"
  6. while true; do
  7. case "$1" in
  8. -h)
  9. printf "\
  10. usage: $0 [-a arch] [stat=system.cpu.numCycles]
  11. Get the value for a gem5 stat from the stats.txt file.
  12. " 1>&2
  13. exit
  14. ;;
  15. *)
  16. common_getopt_case "$@"
  17. ;;
  18. esac
  19. done
  20. if [ $# -gt 0 ]; then
  21. stat="$1"
  22. else
  23. stat=system.cpu[0-9]*.numCycles
  24. fi
  25. common_setup
  26. awk "/^$stat /{ print \$2 }" "${common_m5out_dir}/stats.txt"