gem5-stat 549 B

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