gem5-stat 468 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env bash
  2. set -eu
  3. . common
  4. while getopts a:hs: OPT; do
  5. case "$OPT" in
  6. a)
  7. arch="$OPTARG"
  8. ;;
  9. h)
  10. printf "\
  11. usage: $0 [-a arch] [stat=system.cpu.numCycles]
  12. Get the value for a gem5 stat from the stats.txt file.
  13. " 1>&2
  14. exit
  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. set_common_vars "$arch" true
  25. awk "/^$stat /{ print \$2 }" "${m5out_dir}/stats.txt"