Skip to content

Instantly share code, notes, and snippets.

@taeguk
Last active December 22, 2016 12:56
Show Gist options
  • Save taeguk/438e2ff89c8e46835e433912d6831ed6 to your computer and use it in GitHub Desktop.
Save taeguk/438e2ff89c8e46835e433912d6831ed6 to your computer and use it in GitHub Desktop.
solve_ecl.sh
: '
Sogang University.
Embedded Computer Architecture Class.
2016.
Helpful Bash Script HOMEWORK #3
Made by taeguk (http://taeguk.me).
'
##### Problem 1
cd ~/gem5_output # MODIFY THIS TO YOUR GEM5 OUTPUT FOLDER.
########## (a)
#find . -name 'stats.txt' -exec sh -c "echo \"------- {} -------\"; cat {} | grep 'sim_seconds\|system.cpu.dcache.overall_miss_rate::total' | awk '{print \$1,"\t",\$2}'; echo" \;
while read -r filename; do
echo -e "------ $filename ------";
cat $filename | grep 'sim_seconds\|system.cpu.dcache.overall_miss_rate::total' |
awk '{print $1,"\t",$2}'; echo;
done <<< "`find . -name 'stats.txt' | sort`"
########## (b)
#find . -name 'stats.txt' -exec sh -c "echo \"------- {} -------\"; cat {} | grep 'sim_seconds\|system.l2.overall_miss_rate::total' | awk '{print \$1,"\t",\$2}'; echo" \;
while read -r filename; do
echo -e "------ $filename ------";
cat $filename | grep 'sim_seconds\|system.l2.overall_miss_rate::total' |
awk '{print $1,"\t",$2}'; echo;
done <<< "`find . -name 'stats.txt' | grep 'L2' | sort`"
########## (c)
#find . -name 'stats.txt' -exec sh -c "echo \"------- {} -------\"; cat {} | grep 'sim_seconds\|system.cpu.dcache.overall_mshr_misses::total\|system.cpu.icache.overall_mshr_misses::total\|system.l2.overall_mshr_misses::total' | awk '{print \$1,"\t",\$2}'; echo" \;
echo "==================== With Only L1 Caches ==================="
while read -r filename; do
echo -e "------ $filename ------";
cat $filename | grep 'sim_seconds\|system.cpu.dcache.overall_mshr_misses::total\|system.cpu.icache.overall_mshr_misses::total' |
awk '{print $1,"\t",$2}'; echo;
done <<< "`find . -name 'stats.txt' | grep -v 'L2' | sort`"
echo
echo "==================== With L2 Caches ===================="
while read -r filename; do
echo -e "------ $filename ------";
cat $filename | grep 'sim_seconds\|system.l2.overall_mshr_misses::total' |
awk '{print $1,"\t",$2}'; echo;
done <<< "`find . -name 'stats.txt' | grep 'L2' | sort`"
########## (d)
#find . -name 'stats.txt' -exec sh -c "echo \"------- {} -------\"; cat {} | grep 'sim_seconds\|system.cpu.dcache.overall_miss_rate::total\|system.l2.overall_miss_rate::total\|system.cpu.ipc_total' | awk '{print \$1,"\t",\$2}'; echo" \;
while read -r filename; do
echo -e "------ $filename ------";
cat $filename | grep 'sim_seconds\|system.cpu.dcache.overall_miss_rate::total\|system.l2.overall_miss_rate::total\|system.cpu.ipc_total' |
awk '{print $1,"\t",$2}'; echo;
done <<< "`find . -name 'stats.txt' | sort`"
##### Problem 2
cd ~/output-level-1 # MODIFY THIS TO YOUR McPAT OUTPUT FOLDER.
########## (a), (b)
#cat $filename | grep ':\| = ' | sed 1d | awk -F ' = ' '{print $0}'
while read -r filename; do
echo -e "------ $filename ------";
cat $filename | grep '^ Runtime Dynamic\|^ Total Leakage' | awk -F'[=W]' '{print $1,"\t",$2}';
echo;
done <<< "`find . -type f | sort`"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment