#!/bin/bash
cd ~/simplesim-3.0/benchmarks
INSTS=$(grep "sim_num_insn" ./anagram.txt | awk '{print $2}');
IL1_ACCESSES=$(grep "il1.accesses" ./anagram.txt | awk '{print $2}');
IL1_MISSRATE=$(grep "il1.miss_rate" ./anagram.txt | awk '{print $2}');
DL1_ACCESSES=$(grep "dl1.accesses" ./anagram.txt | awk '{print $2}');
DL1_MISSRATE=$(grep "dl1.miss_rate" ./anagram.txt | awk '{print $2}');
IL2_ACCESSES=$(grep "il2.accesses" ./anagram.txt | awk '{print $2}');
IL2_MISSRATE=$(grep "il2.miss_rate" ./anagram.txt | awk '{print $2}');
DL2_ACCESSES=$(grep "dl2.accesses" ./anagram.txt | awk '{print $2}');
DL2_MISSRATE=$(grep "dl2.miss_rate" ./anagram.txt | awk '{print $2}');
IL1_API='echo "scale=4;$DL1_ACCESSES/$INSTS" | bc -l';
DL1_API='echo "scale=4;$IL1_ACCESSES/$INSTS" | bc -l';
IL2_API='echo "scale=4;$IL2_ACCESSES/$INSTS" | bc -l';
DL2_API='echo "scale=4;$DL2_ACCESSES/$INSTS" | bc -l';
DL1_P='echo "scale=4;$DL1_MISSRATE*5.0" | bc -l';
IL1_P='echo "scale=4;$IL1_MISSRATE*5.0" | bc -l';
IL2_P='echo "scale=4;$IL2_MISSRATE*40.0" | bc -l';
DL2_P='echo "scale=4;$DL2_MISSRATE*40.0" | bc -l';
DL1_PENALTY='echo "scale=4;$DL1_P*$DL1_API" | bc -l';
IL1_PENALTY='echo "scale=4;$IL1_P*$IL1_API" | bc -l';
IL2_PENALTY='echo "scale=4;$IL2_P*$IL2_API" | bc -l';
DL2_PENALTY='echo "scale=4;$DL2_P*$DL2_API" | bc -l';
CPI_a='echo "scale=4;$DL1_PENALTY+$DL2_PENALTY" | bc -l';
CPI_b='echo "scale=4;$IL1_PENALTY+1.0" | bc -l';
CPI_c='echo "scale=4;$IL2_PENALTY+$CPI_b" | bc -l';
#CPI='echo "scale=4;$UL1_P+1.0+$UL2_P" | bc';
CPI='echo "scale=4;$CPI_a+$CPI_c" | bc';
echo $CPI
Estou executando este script. Verifiquei se as variáveis atribuídas do comando grep
foram atribuídas corretamente. No entanto, o prompt bash
retorna
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 2: syntax error
Eu tenho um palpite de que isso tem algo a ver com o comando bc
, mas não consigo descobrir o que parece ser o problema com ele.