Skip to content

Instantly share code, notes, and snippets.

@bontorhumala
Created October 1, 2015 16:17
Show Gist options
  • Save bontorhumala/96e5f85ba79ae3bb7ae3 to your computer and use it in GitHub Desktop.
Save bontorhumala/96e5f85ba79ae3bb7ae3 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#Jalaninnya di dalam /workspace/Powerstone
#Cara pakai: sh automatic.sh <nama_output_file>
min=2 #START DI min
max=16 #SELESAI DI max
inc=2 #INC buat tiap percobaan
echo "Total Cycles,Execution Cycles,Stall Cycles,Nops,Executed Operations" > $1
i=$min
j=0
#loop for each variation
while [ $i -lt $((max+1)) ]
do
../tools/vex-3.43/bin/cc -ms -O4 -fmm=pipe_1_2_fw.mm -o x264 ../Powerstone/src/x264.c
sed -i "s/RES: Alu.0 $i/RES: Alu.0 $((i+inc))/g" pipe_1_2_fw.mm; #NGUBAH KONFIGURASI RESOURCE PROCESSOR
./x264
log_name="ta.log.00"$j
TOTAL_CYCLES=$(awk '($1=="Total")&&($2=="Cycles:"){print $3}' $log_name)
EXECUTION_CYCLES=$(awk '($1=="Execution")&&($2=="Cycles:"){print $3}' $log_name)
STALL_CYCLES=$(awk '($1=="Stall")&&($2=="Cycles:"){print $3}' $log_name)
NOPS=$(awk '($1=="Nops:"){print $2}' $log_name)
EXECUTED_OPERATIONS=$(awk '($1=="Executed")&&($2=="operations:"){print $3}' $log_name)
echo $TOTAL_CYCLES","$EXECUTION_CYCLES","$STALL_CYCLES","$NOPS","$EXECUTED_OPERATIONS >> $1
i=$((i+inc))
j=$((j+1))
done
#cleanups
sed -i "s/RES: Alu.0 $((i))/RES: Alu.0 $min/g" pipe_1_2_fw.mm; #NGUBAH KONFIGURASI RESOURCE PROCESSOR
rm ta.log.*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment