#!/usr/bin/perl

$filename = $ARGV[0];

open(data_file, "<$filename") || die "can't open file: " . $filename . "\n";


$cache_count = 0;
$l1i_size_bytes = 0;
$l1d_size_bytes = 0;
$l2_size_bytes = 0;


#Figure out which column to look at
while(<data_file>){
    split;

    if(/Cache config/){
	$cache_count++;
    }

    if(/cache_size_bytes/){
	if($cache_count == 1){
	    $l1i_size_bytes = $_[1];
	}
	elsif ($cache_count ==2){
	    $l1d_size_bytes = $_[1];
	}
	elsif ($cache_count == 3){
	    $l2_size_bytes = $_[1];
	}

    }
}
close(data_file);

print "l1i_size: " . $l1i_size_bytes . "\n";
print "l1d_size: " . $l1d_size_bytes . "\n";
print "l2_size: " . $l2_size_bytes . "\n";
