📄 compare-runs.prl
字号:
#!/usr/local/bin/perl5 ## 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. ### processes the output of different summary.prl -o perl scripts# stores the information and extracts it for the different files.### -o options are # -o bar# -o mif# -n options are passed down to the inputFile $offset = 0;$usedMXS = 0;@logEntryKeys = ();@extra_space = ();@setLabels = ();print STDERR "Building graphs.... \n";@modes = ('K','U','I','S','T');require "getopt.pl";&Getopt('i:o:n:w:');print STDERR "Howdy, this prevents a core dump \n";if( defined($opt_i) ) { $inputFile = $opt_i;} else { $inputFile = "graph1.prl";}if( defined($opt_o) ){ $output = $opt_o;} else { $output = "bar";}if( defined($opt_n) ){ $name = $opt_n;} else { $name = "mem";}if( defined($opt_w)) { $workload = $opt_w;} else { $workload = "";}print STDERR "Executing compare-runs.prl -i $inputFile -o $output -n $name \n";##DE# # $inputFile must initialize the following arrays# # %fileNames: list of filenames. Key is the run-tag# $numGroups.# @groupLables (1..$numGroups-1)# @numSets (1..$numGroups-1)# setTags[$group][$set] = tag;# @keyText# @keyField# $chosenMode# + the ones with default values# ---------- Default values ----------------$title = "NO-TITLE";$xlabel = "NO-Xlabel";$ylabel = "NO-Ylabel";print STDERR "Including definition file : $inputFile \n";require $inputFile;# Read in the input filesforeach $i (keys %fileNames) { print STDERR "Reading input file for $i :\t$fileNames{$i}"; undef(@missBreakList); undef(%cur); undef(%stall); undef(%missBreak); undef(@curKeys); do $fileNames{$i}; $x_usedMXS{$i} = $usedMXS; #$x_length{$i} = $length; $x_cur{$i}{'length'}{'rate'} = $length; foreach $f (@curKeys) { foreach $mode (@modes) { $x_cur{$i}{$f}{$mode} = $cur{$f}{$mode}; } } foreach $f (@stallBreakdown) { foreach $mode (@modes) { $x_stall{$i}{$f}{$mode} = $stall{$f}{$mode}; } } foreach $f (@logEntryKeys) { if( !($f eq '')) { if( !defined($logCount{$f})) { print STDERR "NotDef \$logCount{$f} \n"; } if( !defined($length)) { print STDERR "NotDef: \$lenght \n"; } $x_logCount{$i}{$f} = $logCount{$f}; $x_cur{$i}{$f}{'rate'} = $logCount{$f} / $length; } } if( $x_usedMXS{$i} ) { print STDERR " used MXS \n"; } else { print STDERR "\n"; } if( $x_usedMXS{$i} ) { for $mode (@modes) { $x_cur{$i}{'instrMCPI'}{$mode} = 0.25; } } else { for $mode (@modes) { $x_cur{$i}{'instrMCPI'}{$mode} = 1.0; } } if( !defined( $missBreakList[0])) { #print STDERR "\n missBreakList not defined \n"; @missBreakList = ('cold','kern-self','kern-other','user-other','user-self','kern-inv','user-inv'); } foreach $f (@missBreakList) { foreach $g ('i','rw','i-rate','rw-rate','rw-instr-rate', 'i-frac','rw-frac','rwi','rwi-frac','rwi-rate', 'k-rwi-rate','k-rw-rate','k-i-rate', 'u-rwi-rate','u-rw-rate','u-i-rate') { $x_cur{$i}{$f}{$g} = $missBreak{$f}{$g}; } } if( $name eq "overview") { $x_logCount{$i}{'Instructions'} = $cur{'MInstr '}{'T'}; $x_logCount{$i}{'L1'} = $cur{'L1i'}{'T'} + $cur{'L1d'}{'T'}; $x_logCount{$i}{'L2'}= $cur{'L2i'}{'T'} + $cur{'L2d'}{'T'}; if( defined( $x_logCount{$i}{'UTLB-READ'} )) { $x_logCount{$i}{'UTLB'} = $x_logCount{$i}{'UTLB-WRITE'} + $x_logCount{$i}{'UTLB-READ'}; } else { $x_logCount{$i}{'UTLB'} = $x_logCount{$i}{'UTLB_WMISS'} + $x_logCount{$i}{'UTLB_RMISS'}; } if( !defined($x_logCount{$i}{'EXC_RMISS'})) { print STDERR "NotDef: \$x_logCount{$i}{'EXC_RMISS'} \n"; } if( !defined($x_logCount{$i}{'EXC_WMISS'})) { print STDERR "NotDef: \$x_logCount{$i}{'EXC_WMISS'} \n"; } $x_logCount{$i}{'PAGEFAULT'} = $x_logCount{$i}{'EXC_RMISS'} + $x_logCount{$i}{'EXC_WMISS'} - $x_logCount{$i}{'UTLB'}; $x_logCount{$i}{'EXC_OTHER'} = $x_logCount{$i}{'EXC_CPU'} + $x_logCount{$i}{'EXC_MOD'}; foreach $f ('UTLB','PAGEFAULT','EXC_OTHER','Instructions','L1','L2') { $x_cur{$i}{$f}{'rate'} = $x_logCount{$i}{$f} / $length; } }}if( defined($postprocMethod)) { &$postprocMethod();}# #################################################################### compute some scaled information# ###################################################################for $i (0..$numGroups-1) { $tag = $setTags[$i][0]; if( !defined($tag) ) { print STDERR "Not defined: \$setTags[$i][0] \n"; } # Actual speedup # ############## $normLength = $x_cur{$tag}{'Wallclock'}{'T'}; if( !defined($normLength)) { print STDERR " Not defined \$x_cur{$tag}{'Wallclock'}{'T'}\n"; } for $j (0..$numSets-1) { $tag = $setTags[$i][$j]; if( $normLength > 0 ) { if( !defined($x_cur{$tag}{'Wallclock'}{'I'})){ print STDERR "NotDef \$x_cur{$tag}{'Wallclock'}{'I'} \n"; } $x_cur{$tag}{'Norm-Idle'}{'T'} = 100 * $x_cur{$tag}{'Wallclock'}{'I'} / $normLength; $x_cur{$tag}{'Norm-Sync'}{'T'} = 100 * $x_cur{$tag}{'Wallclock'}{'S'} / $normLength; $cpuTime =0; $memTime = 0; for $mode ('K','U') { $modeTime = $x_cur{$tag}{'Wallclock'}{$mode} ; $thisCpuTime = $modeTime * ( $x_cur{$tag}{'Instr-Time'}{$mode} + $x_cur{$tag}{'Pipe-Time'}{$mode}); $cpuTime += $thisCpuTime; $thisMemTime = $modeTime * ( $x_cur{$tag}{'L1d-Time'}{$mode} + $x_cur{$tag}{'L2d-Time'}{$mode} + $x_cur{$tag}{'Upg-Time'}{$mode} + $x_cur{$tag}{'L1i-Time'}{$mode} + $x_cur{$tag}{'L2i-Time'}{$mode}); $memTime += $thisMemTime; $x_cur{$tag}{'Norm-CPU'}{$mode} =$thisCpuTime / $normLength; $x_cur{$tag}{'Norm-Mem'}{$mode} =$thisMemTime / $normLength; } $x_cur{$tag}{'Norm-CPU'}{'T'} =$cpuTime / $normLength; $x_cur{$tag}{'Norm-Mem'}{'T'} =$memTime / $normLength; $x_cur{$tag}{'Speedup'}{'T'} = $normLength / $x_cur{$tag}{'Wallclock'}{'T'};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -