mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-28 04:24:26 +01:00
gem5-stat ported
This commit is contained in:
@@ -236,6 +236,7 @@ def setup(parser, **extra_args):
|
|||||||
this.target_dir = os.path.join(this.buildroot_out_dir, 'target')
|
this.target_dir = os.path.join(this.buildroot_out_dir, 'target')
|
||||||
this.gem5_run_dir = os.path.join(this.out_arch_dir, 'gem5', str(args.run_id))
|
this.gem5_run_dir = os.path.join(this.out_arch_dir, 'gem5', str(args.run_id))
|
||||||
this.m5out_dir = os.path.join(this.gem5_run_dir, 'm5out')
|
this.m5out_dir = os.path.join(this.gem5_run_dir, 'm5out')
|
||||||
|
this.stats_file = os.path.join(this.m5out_dir, 'stats.txt')
|
||||||
this.trace_txt_file = os.path.join(this.m5out_dir, 'trace.txt')
|
this.trace_txt_file = os.path.join(this.m5out_dir, 'trace.txt')
|
||||||
this.gem5_termout_file = os.path.join(this.gem5_run_dir, 'termout.txt')
|
this.gem5_termout_file = os.path.join(this.gem5_run_dir, 'termout.txt')
|
||||||
this.qemu_run_dir = os.path.join(this.out_arch_dir, 'qemu', str(args.run_id))
|
this.qemu_run_dir = os.path.join(this.out_arch_dir, 'qemu', str(args.run_id))
|
||||||
|
|||||||
45
gem5-stat
45
gem5-stat
@@ -1,25 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env python3
|
||||||
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
|
import re
|
||||||
common_gem5=true
|
import common
|
||||||
while getopts "h${common_getopts_flags}" OPT; do
|
parser = common.get_argparse(
|
||||||
case "$OPT" in
|
argparse_args={'description':'Get the value of a gem5 stat from the stats.txt file.'}
|
||||||
h)
|
)
|
||||||
printf "\
|
parser.add_argument(
|
||||||
usage: $0 [-a arch] [stat=system.cpu.numCycles]
|
'stat',
|
||||||
Get the value for a gem5 stat from the stats.txt file.
|
default='^system.cpu[0-9]*.numCycles$',
|
||||||
" 1>&2
|
help='Python regexp matching the full stat name of interest',
|
||||||
exit
|
nargs='?',
|
||||||
;;
|
)
|
||||||
?)
|
args = common.setup(parser)
|
||||||
common_getopts_case "$OPT"
|
stat_re = re.compile(args.stat)
|
||||||
;;
|
with open(common.stats_file, 'r') as statfile:
|
||||||
esac
|
for line in statfile:
|
||||||
done
|
if line[0] != '-':
|
||||||
shift "$(($OPTIND - 1))"
|
cols = line.split()
|
||||||
if [ $# -gt 0 ]; then
|
if len(cols) > 1 and stat_re.search(cols[0]):
|
||||||
stat="$1"
|
print(cols[1])
|
||||||
else
|
|
||||||
stat=system.cpu[0-9]*.numCycles
|
|
||||||
fi
|
|
||||||
common_setup
|
|
||||||
awk "/^$stat /{ print \$2 }" "${common_m5out_dir}/stats.txt"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user