Files
linux-kernel-module-cheat/gem5-stat
Ciro Santilli 036225b268 run: use getopt
2018-08-23 08:54:47 +01:00

27 lines
593 B
Bash
Executable File

#!/usr/bin/env bash
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
common_gem5=true
parsed=$(getopt -o "h${common_getopt_flags}" -l "$common_getopt_flags_long" -- "$@")
eval set -- "$parsed"
while true; do
case "$1" in
-h)
printf "\
usage: $0 [-a arch] [stat=system.cpu.numCycles]
Get the value for a gem5 stat from the stats.txt file.
" 1>&2
exit
;;
*)
common_getopt_case "$@"
;;
esac
done
if [ $# -gt 0 ]; then
stat="$1"
else
stat=system.cpu[0-9]*.numCycles
fi
common_setup
awk "/^$stat /{ print \$2 }" "${common_m5out_dir}/stats.txt"