gem5: add run -l option to restore latest checkpoint with directory timestamps

This commit is contained in:
Ciro Santilli
2018-08-12 21:06:06 +01:00
parent 8cd6ffda2a
commit 4e648479f2
4 changed files with 95 additions and 71 deletions

13
run
View File

@@ -18,6 +18,7 @@ extra_flags_qemu=
extra_opts=
gem5opts=
gem5_fsbiglittle=false
gem5_restore_last_checkpoint=
lkmc_eval=
initrd=false
initramfs=false
@@ -33,7 +34,7 @@ trace_enabled=false
# just to prevent QEMU from emitting a warning that '' is not valid.
trace_type=pr_manager_run
vnc=
while getopts a:c:DdE:e:F:f:G:ghIiKkL:M:m:N:n:PQ:RrT:t:U:uVX:x OPT; do
while getopts a:c:DdE:e:F:f:G:ghIiKkL:l:M:m:N:n:PQ:RrT:t:U:uVX:x OPT; do
case "$OPT" in
a)
common_arch="$OPTARG"
@@ -91,6 +92,9 @@ while getopts a:c:DdE:e:F:f:G:ghIiKkL:M:m:N:n:PQ:RrT:t:U:uVX:x OPT; do
L)
common_linux_variant="$OPTARG"
;;
l)
gem5_restore_last_checkpoint="${OPTARG}"
;;
M)
common_gem5_variant="$OPTARG"
;;
@@ -194,6 +198,13 @@ if "$common_gem5"; then
else
gem5_arch=ARM
fi
if [ -n "$gem5_restore_last_checkpoint" ]; then
cpt_pref='^cpt\.'
latest_cpt_basename="$(ls -crt "$common_m5out_dir" | grep -E "$cpt_pref" | tail -n "$gem5_restore_last_checkpoint" | head -n 1)"
n="$(ls -1 "$common_m5out_dir" | grep -E "$cpt_pref" | sort -k 2 -n -t . | grep -n "$latest_cpt_basename" | cut -d : -f 1)"
extra_flags="${extra_flags}-r ${n} \\
"
fi
if "$trace_enabled"; then
gem5opts="${gem5opts} --debug-flags='${trace_type}' \\
"