-
Notifications
You must be signed in to change notification settings - Fork 0
/
unil1l2.pl
195 lines (102 loc) · 5.01 KB
/
unil1l2.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/usr/bin/perl
@b = ("32","64");
@a = ("1","2,","4","8");
@f = ("f","l","r");
$sl1u=128*1024;
$sl2u=1024*1024;
$sl1s=64*1024;
$sl2s=512*1024;
$count = 0;
foreach my $blk1 (@b)
{
foreach my $asso1 (@a)
{
foreach my $rep1 (@f)
{
$nl1 = $sl1u/($blk1*$asso1);
foreach my $blk2 (@b)
{
foreach my $asso2 (@a)
{
foreach my $rep2 (@f)
{
$nl2 = $sl2u/($blk2*$asso2);
if($blk2<=$blk1)
{
$count = $count + 1;
system('cat /dev/null > ./outputs/temp.txt');
system('echo "*'.$count.'*l1:'.$nl1.':'.$blk1.':'.$asso1.':'.$rep1.'l2:'.$nl2.':'.$blk2.':'.$asso2.':'.$rep2.'" >> ./outputs/temp.txt');
system('touch output.txt');
system('chmod 777 output.txt');
system("./sim-cache -redir:sim ./output.txt -cache:il1 dl1 -cache:dl1 ul1:$nl1:$blk1:$asso1:$rep1 -cache:il2 none -cache:dl2 ul2:$nl2:$blk2:$asso2:$rep2 -tlb:itlb none -tlb:dtlb none ./benchmarks/cc1.alpha -O ./benchmarks/1stmt.i");
system('cat output.txt | grep "sim_num_insn" >> ./outputs/gcc_def.txt ');
system('cat output.txt | grep "ul1.accesses" >> ./outputs/gcc_def.txt ');
system('cat output.txt | grep "ul1.miss_rate" >> ./outputs/gcc_def.txt ');
system('cat output.txt | grep "ul2.accesses" >> ./outputs/gcc_def.txt ');
system('cat output.txt | grep "ul2.miss_rate" >> ./outputs/gcc_def.txt ');
system('cat output.txt | grep "sim_num_insn" >> ./outputs/temp.txt');
system('cat output.txt | grep "ul1.accesses" >> ./outputs/temp.txt');
system('cat output.txt | grep "ul1.miss_rate" >> ./outputs/temp.txt');
system('cat output.txt | grep "ul2.accesses" >> ./outputs/temp.txt');
system('cat output.txt | grep "ul2.miss_rate" >> ./outputs/temp.txt');
#system('rm output.txt');
my @lines; # Hold the lines you want
open (my $file, '<', './outputs/temp.txt') or die $!; # Open the file for reading
while (my $line = <$file>)
{
next if $line =~ m/^#/; # Look at each line and if if isn't a comment
push (@lines, $line); # we will add it to the array.
}
close $file;
my $sw = $lines[1];
my $sim_ins=@{[$sw =~ m/\d+/g]}[0];
print "$sim_ins \n";
my $qw = $lines[2];
my $ul1access=@{[$qw =~ m/\s+\d+/g]}[0];
print "$ul1access \n";
my $pp = $lines[3];
my $l1miss=@{[$pp =~ m/([0-9]+\.+[0-9]+[0-9]+[0-9])+/g]}[0];
print "$l1miss \n";
my $er = $lines[4];
my $l2access=@{[$er =~ m/\s+\d+/g]}[0];
print "$l2access \n";
my $gh = $lines[5];
my $l2miss=@{[$gh =~ m/([0-9]+\.+[0-9]+[0-9]+[0-9])+/g]}[0];
print "$l2miss \n";
if( $sim_ins > 0)
{my $cpi = 1 + ( 5* $l1miss + 40* $l2miss * ($l2access/$sim_ins));}
else
{my $cpi = 0;}
system('echo "*'.$count.'*l1:'.$nl1.':'.$blk1.':'.$asso1.':'.$rep1.'l2:'.$nl2.':'.$blk2.':'.$asso2.':'.$rep2.'" >> ./outputs/gcc_def_cpi.txt');
system('echo "'.$cpi.'" >> ./outputs/gcc_def_cpi.txt');
system('echo "*'.$count.'*l1:'.$nl1.':'.$blk1.':'.$asso1.':'.$rep1.'l2:'.$nl2.':'.$blk2.':'.$asso2.':'.$rep2.'" >> ./outputs/ana_uni.txt');
system('touch output.txt');
system('chmod 777 output.txt');
system("./sim-cache -redir:sim ./output.txt -cache:il1 dl1 -cache:dl1 ul1:$nl1:$blk1:$asso1:$rep1 -cache:il2 none -cache:dl2 ul2:$nl2:$blk2:$asso2:$rep2 -tlb:itlb none -tlb:dtlb none ./benchmarks/anagram.alpha ./benchmarks/words\<./benchmarks/anagram.in\> OUT");
system('cat output.txt | grep "sim_num_insn" >> ./outputs/ana_uni.txt');
system('cat output.txt | grep "ul1.accesses" >> ./outputs/ana_uni.txt');
system('cat output.txt | grep "ul1.miss_rate" >> ./outputs/ana_uni.txt');
system('cat output.txt | grep "ul2.accesses" >> ./outputs/ana_uni.txt');
system('cat output.txt | grep "ul2.miss_rate" >> ./outputs/ana_uni.txt');
#system('rm output.txt');
system('echo "*'.$count.'*l1:'.$nl1.':'.$blk1.':'.$asso1.':'.$rep1.'l2:'.$nl2.':'.$blk2.':'.$asso2.':'.$rep2.'" >> ./outputs/go_uni.txt');
system('touch output.txt');
system('chmod 777 output.txt');
system("./sim-cache -redir:sim ./output.txt -cache:il1 dl1 -cache:dl1 ul1:$nl1:$blk1:$asso1:$rep1 -cache:il2 none -cache:dl2 ul2:$nl2:$blk2:$asso2:$rep2 -tlb:itlb none -tlb:dtlb none ./benchmarks/go.alpha 50 9 ./benchmarks/2stone9.in");
system('cat output.txt | grep "sim_num_insn" >> ./outputs/go_uni.txt');
system('cat output.txt | grep "ul1.accesses" >> ./outputs/go_uni.txt');
system('cat output.txt | grep "ul1.miss_rate" >> ./outputs/go_uni.txt');
system('cat output.txt | grep "ul2.accesses" >> ./outputs/go_uni.txt');
system('cat output.txt | grep "ul2.miss_rate" >> ./outputs/go_uni.txt');
#system('rm output.txt');
}
$count = $count + 1;
print "$nl1 \n";
print "$nl2 \n";
print "$count \n\n";
}
}
}
}
}
}