#!/usr/bin/perl # Input is back-to-back dinero simulations # Output is a list of cache parameters and miss/traffic ratios # This is for the convenience of students, and is not represented # as a bullet-proof application program. Please check any results for # common-sense. Please report any bugs to the course instructor. # get entire input file into an array @aa = ; while (scalar(@aa)) { $line = shift(@aa); @words = split(" ", $line); $www = shift(@words); if ($www eq "CACHE") { shift(@words); $blocksize = substr(shift(@words),10); chop $blocksize; $subblocksize = substr(shift(@words),14); chop $subblocksize; $wordsize = substr(shift(@words),9); chop $wordsize; $usize = substr(shift(@words),6); chop $usize; $dsize = substr(shift(@words),6); chop $dsize; $isize = substr(shift(@words),6); chop $isize; $buswidth = substr(shift(@words),10); chop $buswidth; } if ($www eq "POLICIES:") { $assoc = substr(shift(@words),6); $assoc = substr($assoc,0,length($assoc)-5); $replacement = substr(shift(@words),12); chop $replacement; $fetch = substr(shift(@words),6); chop $fetch; $write = substr(shift(@words),6); chop $write; $allocate = substr(shift(@words),9); chop $allocate; } if ($www eq "Demand") { $www = shift(@words); if ($www eq "Misses") { $line = shift(@aa); @words = split(" ", $line); $missratio = shift(@words); $imiss = shift(@words); $dmiss = shift(@words); $rmiss = shift(@words); $wmiss = shift(@words); } } if ($www eq "Total") { $www = shift(@words); if ($www eq "Traffic") { $line = shift(@aa); @words = split(" ", $line); shift(@words); shift(@words); shift(@words); shift(@words); $traffic_ratio = shift(words); # modify the below print statements to suit your needs # for example: # print $dsize, "\t", $dmiss, "\n"; # would print just the data cache size and Dcache miss ratio for # each dinero run. Note that perl uses printf-like special characters print "blocksize=" , $blocksize; print ", sub-blocksize=" , $subblocksize ; print ", wordsize=", $wordsize ; print ", Usize=", $usize ; print ", Dsize=", $dsize ; print ", Isize=" , $isize ; print ", bus-width=", $buswidth ; print ", assoc=", $assoc , "-way" ; print ", replacement=", $replacement ; print ", fetch=", $fetch ; print ", write=", $write ; print ", allocate=", $allocate ; print ", Total miss ratio=", $missratio ; print ", Imiss=", $imiss ; print ", Dmiss=", $dmiss ; print ", Readmiss=", $rmiss ; print ", Writemiss=", $wmiss ; print ", Traffic_ratio=", $traffic_ratio; print "\n"; # newline } } }