mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 18:25:57 +01:00
Don't pass all arguments explicitly, just use existing vars. Prefix all common_setup inputs and outputs with common_ to avoid name conflicts.
27 lines
531 B
Bash
Executable File
27 lines
531 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eu
|
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
|
|
common_gem5=true
|
|
while getopts a:hs: OPT; do
|
|
case "$OPT" in
|
|
a)
|
|
common_arch="$OPTARG"
|
|
;;
|
|
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
|
|
;;
|
|
esac
|
|
done
|
|
shift "$(($OPTIND - 1))"
|
|
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"
|