speedup.prl 2.61 KB
#!/usr/local/bin/perl5 -w
#
# Copyright (C) 1996-1998 by the Board of Trustees
#    of Leland Stanford Junior University.
# 
# This file is part of the SimOS distribution. 
# See LICENSE file for terms of the license. 
#


#
# Determine speedup info by comparing the summary output
# of the runs with varying number of CPUs. 
#
# ASPLOS/SUIF paper



require "getopts.pl";
&Getopts('i:n:');

if( defined($opt_i) ) { 
    $inputFile = $opt_i;
} else {
    $inputFile = "prlvars.prl";
}

if (defined($opt_n)) {
    $name = $opt_n;

} else { 
    die "speedup.prl requires the name of the wload! (-n) \n";
}


if (defined($ENV{'SIMOS_DIR'}) ) { 
    $xx = "$ENV{'SIMOS_DIR'}/src/apps/scripts";
    print STDERR "Added $xx to perl search path. \$SIMOS_DIR defines it \n";
    unshift(@INC,$xx);
} else { 
    print STDERR "SIMOS_DIR is not an environment variable \n";
}
require "simos-lib.prl";

$group{1} = '01';
$group{2} = '02';
$group{4} = '04';
$group{8} = '08';
$group{16} = '16';

do $inputFile;

sub PrintCmp {
    my $f = shift;
    my $mode = shift;
    
    my $n = "$name-01-$mode";
    my $base =  $data{$n}{$f};
    if( !defined($base)) {
        print STDERR "NotDef \$data{$n}{$f} \n";
    }
    if (defined($format{$f})) {
        $x = sprintf($format{$f},$base);
    } else { 
        $x = $base;
    }
    if ($base > 0 ) { 
        printf("%-20s : %10s (   1)   |","$mode-$f",$x);
    } else {
        printf("%-20s : %10s          |","$mode-$f",$x);
    }
    for $i (2,4,8,16) {   
        $val = $data{"$name-$group{$i}-$mode"}{$f};
        if (defined($format{$f})) {
            $x = sprintf($format{$f},$val);
        } else { 
            $x = $val;
        }
        if( $base==0 && $val > 0 ) { 
            $base = $val;
        }
        if( $base == 0 || $val > 100 * $base ) {          
            printf("%10s        |", $x);
        } else { 
            printf("%10s (%5.2f)|", $x,1.0*$val/$base);
        }
    } 
       print "\n";

}


print "\nSPEEDUP INFORMATION SUMMARY FOR $name \n\n\n";

print "                         1 CPU             |         2  CPUs  |       4  CPUs    |          8 CPUs  |        16  CPUs |\n";
print " ---------------------------------------------------------------------------------------------------------------- \n";

for $mode ('total','user','userspin') { 
    PrintCmp("seconds",$mode);
}
PrintCmp("_instr",'user');

print "--------------------------------- \n";
PrintCmp("dL2Miss",'total');
PrintCmp("dL2Miss",'userspin');
PrintCmp("missclass-cold",'user');
PrintCmp("missclass-repl",'user');
PrintCmp("missclass-true",'user');
PrintCmp("missclass-false",'user');
PrintCmp("missclass-other",'user');