⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 summary.prl

📁 一个用在mips体系结构中的操作系统
💻 PRL
字号:
#!/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. #if (defined($ENV{'SIMTOOLS'}) ) {     unshift(@INC,"$ENV{'SIMTOOLS'}/apps/scripts");}#if (defined($ENV{'SIMOS_DIR'})) { #    unshift(@INC,"$ENV{'SIMOS_DIR'}/src/apps/scripts");#}require "tree.prl";$logfile = $ARGV[0] || "cpu.log";$startnode = $ARGV[1] || "ROOT";%states = ("ROOT" => ["user"],           "kernel" => ["kernel"],           "idle" => ["idle"],           "sync" => ["sync"],           "rpcwait" => ["rpcwait"],           "pal" => ["pal"]           );$tree = &ParseTree($logfile, "modes");$comp = SumTree($tree, $startnode, \%states, 1);#############################pretty printingsub PrintCount {    ($format, $field) = @_;    my $total = 0;    printf "%-20s ", $field;        foreach $state (sort(keys %$comp)) {        if ($comp->{$state}{$field} != -1) {            $total += $comp->{$state}{$field};            printf $format, $comp->{$state}{$field};        } else {            printf "%15s ", "undef";        }    }    printf("| ");    printf $format, $total;    printf "\n";}sub PrintSep {    print "---------------------";    print "---------------------";    print "---------------------";    print "---------------------";    print "---------------------";    print "--------------------\n";}PrintCount("%15s ", "name");PrintSep();PrintCount("%15.3f ", "seconds");PrintCount("%15.0f ", "_cycles");PrintCount("%15.0f ", "_instr");PrintSep();if (1) {     foreach $i (@fieldname) {         	PrintCount("%15d ",$i);    }	}	PrintSep();for $i (@field_time) {    PrintCount("%15.3f ","time-$i");}PrintSep(); for $i ('cold','repl','true','false','other') {    PrintCount("%15.3f", "time-$i");}PrintSep();if (1) {     for $i ('cold','true','false','repl','other') {         PrintCount("%15.3f ","missclass-$i");    }    PrintSep();}if (defined($fieldPos{'dL2DirtyStall'})) {     for $i ('lat-l1','lat-upg','lat-clean','lat-dirty') {        PrintCount("%15.3f ",$i);    }    PrintSep();}PrintCount("%15.3f ","dL1MR");PrintCount("%15.3f ","dL2MR");PrintSep();PrintCount("%15.3f ","iMCPI");PrintCount("%15.3f ","dMCPI");PrintCount("%15.3f ","dL2MCPI");if ($config{'FalseSharing'} eq "Yes") {    PrintSep();    PrintCount("%15.3f ","dMCPI-cold");    PrintCount("%15.3f ","dMCPI-repl");    PrintCount("%15.3f ","dMCPI-true");    PrintCount("%15.3f ","dMCPI-false");    PrintCount("%15.3f ","dMCPI-other");}if (0) {    PrintSep();    for $i ('L2LocalStall', 'L2RemoteStall',             'dL2RemoteStall', 'dL2LocalStall',            'iL2RemoteStall', 'iL2LocalStall') {        PrintCount("%15.0f ",$i);    }    for $i ('ilat-local','dlat-local','lat-local',            'ilat-remote','dlat-remote','lat-remote') {        PrintCount("%15.3f ",$i);    }}sub PrintFrac {    ($nm, $f, $t) = @_;    printf "+ %-15s   %6.0f\n", $nm, 100 * $f / $t;}sub PrintAbs {    ($nm, $f) = @_;    printf "+ %-15s   %10.3f\n", $nm, $f;}if (0) {    PrintSep();    $clock = 1.0 * $config{"Clock"};    $kexec =  $comp->{"kernel"}{"seconds"};    $sync =  $comp->{"sync"}{"seconds"};    $rpc  = $comp->{"rpcwait"}{"seconds"};    $totkernel = $kexec + $sync + $rpc;    $tot = $comp->{"user"}{"seconds"} + $comp->{"idle"}{"seconds"} + $totkernel;    print "\n";    printf "Measurement period %.2f seconds\n", $tot / 8;    print "\nExecution time breakdown:\n\n";    PrintFrac('user', $comp->{"user"}{"seconds"}, $tot);    PrintFrac('totkernel', $totkernel, $tot);    PrintFrac('   exec', $kexec, $tot);    PrintFrac('   sync', $sync, $tot);    PrintFrac('   rpc', $rpc, $tot);    PrintFrac('idle', $comp->{"idle"}{"seconds"}, $tot);    print "\nKernel time breakdown:\n\n";    $lstall = $comp->{"kernel"}{"L2LocalStall"} / $clock;    $rstall = $comp->{"kernel"}{"L2RemoteStall"} / $clock;    $useful = $totkernel - ($lstall + $rstall + $sync + $rpc);    PrintFrac('useful', $useful, $totkernel);    PrintFrac('loc stall', $lstall, $totkernel);    PrintFrac('rem stall', $rstall, $totkernel);    PrintFrac('sync', $sync, $totkernel);    PrintFrac('rpc wait', $rpc, $totkernel);    print "\nAbsolute seconds:\n\n";    PrintAbs('kernel exec sec', $useful /8 );    PrintAbs('kernel other sec', ($totkernel - $useful) / 8);    PrintAbs('user sec', $comp->{"user"}{"seconds"} / 8);    PrintAbs('idle sec', $comp->{"idle"}{"seconds"} / 8);    print "\nInstruction counts (millions):\n\n";        PrintAbs('kexec count', $comp->{"kernel"}{"_instr"} / 1000000);    PrintAbs('user count', $comp->{"user"}{"_instr"} / 1000000);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -