📄 hivepostpmake
字号:
#!/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. ### this script depends on the following## 1) a log message of the following form when a fault is injected# FAULT: <type> cell <cell> cycles <cycles>## 2) log printfs from the pmake script as to when files are started# finsihed, verification of output, etc## 3) log messages done by annotations when (lset, recovery) start and end## 4) cell configuration info (printed by simos)## fileStatus array## item 0: state of file# 0: nothing# 1: started work# 2: finished work# 3: bad sum# 4: master saw corruption that slave did not## item 1: cell started on# item 2: sum part 1# item 3: sum part 2if (!$ARGV[0]) { $verbose = 1; doFile('cpu.log');} else { if ($#ARGV == 0) { $verbose = 1; } else { $verbose = 0; } foreach $i (0..$#ARGV) { print "DOING $ARGV[$i]\n"; doFile($ARGV[$i]); }}sub doFile { ($file) = @_; local($pmakeNum, $numCells, $MHZ, %fileStatus, $pmakeStart); local($faultTime, @cellInfo, @cpu2cell, $faultCell); local(@freememcycle, @freemem); %fileStatus = ('mainN.o' => [0, 0, 24453, 42], 'bookN.o' => [0, 0, 51971, 52], 'genmovesN.o' => [0, 0, 33655, 20], 'ataks.o' => [0, 0, 33183, 6]); $pmakeNum = 0; reset; open(INFILE, $file); while (<INFILE>) { if (/LOG \s+ (\d+) \s+ printf \s+ cpu=(\d) \s+ (\S+) /x) { $cycle = $1; $cpu = $2; $rest = $'; if ($rest =~ /starting pmake (\d)/) { $pmakeNum = $1; $pmakeStart = $cycle; if ($pmakeNum > 1) { &printStatus; } if ($verbose) { print "\nStarting pmake workload \#$pmakeNum at $cycle\n"; print "===========================\n"; } } elsif ($rest =~ /finished pmake (\d)/) { $pmakeNum = $1; if ($verbose) { print "===========================\n"; print "Finished pmake workload \#$pmakeNum at $cycle\n\n"; } if ($pmakeStart && $MHZ) { $seconds = ($cycle - $pmakeStart) / (1000000.0 * $MHZ); if ($verbose) { print "Pmake \#$pmakeNum completed in $seconds seconds\n"; } $pmakeStart = 0; } else { if ($verbose) { print "Pmake \#$pmakeNum completion time not available.\n"; } } if (($pmakeNum == 1) && (defined($faultTime)) && $MHZ) { foreach $cell (0..$numCells-1) { if ($faultTime && $cellInfo[$cell]{lsetStart} && $cellInfo[$cell]{lsetFinish} && $cellInfo[$cell]{recoveryStart} && $cellInfo[$cell]{recoveryFinish}) { $detectLat = ($cellInfo[$cell]{lsetStart} -$faultTime) / (1000.0 * $MHZ); $agreeLat = ($cellInfo[$cell]{lsetFinish} -$cellInfo[$cell]{lsetStart}) / (1000.0 * $MHZ); $recoverLat = ($cellInfo[$cell]{recoveryFinish} -$cellInfo[$cell]{lsetStart}) / (1000.0 * $MHZ); if ($verbose) { print "cell $cell "; printf("detect: %5.2f ms agree: %5.2f ms recover(tot): %5.2f ms\n", $detectLat, $agreeLat, $recoverLat); } } elsif ($faultCell == $cell) { print "cell $cell CRASHED\n"; } else { print "cell $cell ???\n"; } } } if ($verbose) { print "\n"; } $pmakeNum = 0; } elsif ($rest =~ /started: (\S*)/) { $file = $1; if (!defined($cpu2cell[$cpu])) { print "ASSERT: cell configuration not present.\n"; exit; } if ($verbose) { printf("Starting compile on cell $cpu2cell[$cpu] file %-11s at %12d\n", $file, $cycle); } $fileStatus{$file}[0] = 1; $fileStatus{$file}[1] = $cpu2cell[$cpu]; } elsif ($rest =~ /finished: (\d*) (\d*) (\S*)/) { $sum1 = $1; $sum2 = $2; $file = $3; if ($verbose) { printf("Finished compile on cell $cpu2cell[$cpu] file %-11s at %12d\n", $file, $cycle); } $fileStatus{$file}[0] = 2; if (($sum1 != $fileStatus{$file}[2]) || ($sum2 != $fileStatus{$file}[3])) { $fileStatus{$file}[0] = 3; } } elsif ($rest =~ /verify: (\d*) (\d*) (\S*)/) { $sum1 = $1; $sum2 = $2; $file = $3; if (($fileStatus{$file}[0] != 3) && (($sum1 != $fileStatus{$file}[2]) || ($sum2 != $fileStatus{$file}[3]))) { $fileStatus{$file}[0] = 4; } } } elsif (/^FAULT: \s+ \S+ \s+ cell \s+ (\d+) \s+ cycles \s+ (\d+) /x) { $faultCell = $1; $faultTime = $2; if ($verbose) { print; } } elsif (/^RECOVERY \s+ (\S+) \s+ cycle=(\d+) \s+ cpu=(\d+) /x) { $op = $1; $cycle = $2; $cell = $cpu2cell[$3]; if (($op eq "lsetStart") || (($op eq "recoveryStart"))) { if (!$cellInfo[$cell]{$op}) { $cellInfo[$cell]{$op} = $cycle; } else { print "RECOVERY TWICE\n" } } elsif ($op eq "lsetFinish") { if ($cellInfo[$cell]{lsetStart} && !$cellInfo[$cell]{lsetFinish}) { $cellInfo[$cell]{lsetFinish} = $cycle; if ($verbose) { print " \#\# Agreement on cell $cell "; print "($cellInfo[$cell]{lsetStart} -> "; print "$cellInfo[$cell]{lsetFinish})\n"; } } } elsif ($op eq "recoveryFinish") { if ($cellInfo[$cell]{recoveryStart} && !$cellInfo[$cell]{recoveryFinish}) { $cellInfo[$cell]{recoveryFinish} = $cycle; if ($verbose) { print " \#\# Recovery on cell $cell "; print "($cellInfo[$cell]{recoveryStart} -> "; print "$cellInfo[$cell]{recoveryFinish})\n"; } } } } elsif (/^Cell(\d): CPUmask (\S+) Memstart (\S+) Memsize (\S+)/) { $cell = $1; $cpumask = oct($2); $memstart = oct($3); $memsize = oct($4); $cellInfo[$cell]{firstpage} = $memstart >> 12; $cellInfo[$cell]{lastpage} = ($memstart >> 12) + ($memsize >> 12) - 1; foreach $i (0..32) { if (($cpumask >> $i) & 1) { $cpu2cell[$i] = $cell; } } } elsif (/^FW_Summary \s+ (\d+) \s+ cell=(\d) \s+ prot \s+ (\S+) \s+ unprot \s+ (\S+) \s+ /x) { $cycle = $1; $cell = $2; # $prot = $3; $unprot = $4; if ($freememcycle[$cell] != $cycle) { print "BIGTIME ERROR\n"; } # $dataPages = ($prot + $unprot) - $freemem[$cell]; $unprotPercent = $unprot; if (!defined($cellInfo[$cell]{min}) || ($unprotPercent < $cellInfo[$cell]{min})) { $cellInfo[$cell]{min} = $unprotPercent; } if (!defined($cellInfo[$cell]{max}) || ($unprotPercent > $cellInfo[$cell]{max})) { $cellInfo[$cell]{max} = $unprotPercent; } if (!defined($cellInfo[$cell]{total})) { $cellInfo[$cell]{total} = 0; $cellInfo[$cell]{count} = 0; } else { $cellInfo[$cell]{total} += $unprotPercent; $cellInfo[$cell]{count}++; } } elsif (/^FREEMEM \s+ cycle=(\d+) \s+ cell=(\d+) \s+ (\d+) /x) { $cell = $2; $freememcycle[$cell] = $1; $freemem[$cell] = $3; } elsif (/^PROCESS/) { if ($verbose == 2) { print; } } elsif (/^fault set/) { print; } elsif (/^REMFORK/) { if ($verbose) { print; } } elsif (/^ERROR/) { print; } elsif (?^Firewall configure: (\d) cells?) { $numCells = $1; } elsif (?^MACHINE Clock\s*(\d*)?) { $MHZ = $1; } } close(INFILE); &printStatus; ## ## print firewall status ## if ($verbose) { print "\n"; print "=================\n"; print " Firewall Stats\n"; print "=================\n\n"; print "Unprotected pages by cell:\n"; print "--------------------------\n"; foreach $cell (0..$numCells-1) { if ($cellInfo[$cell]{count}) { printf("cell %d min %6.2f%% max %6.2f%% avg %6.2f%%\n", $cell, $cellInfo[$cell]{min}, $cellInfo[$cell]{max}, $cellInfo[$cell]{total}/$cellInfo[$cell]{count}); } } print "\n"; } print "\n";}exit;sub pageToPageHome { ($page) = @_; foreach $cell (0..$numCells-1) { if (($page >= $cellInfo[$cell]{firstpage}) && ($page <= $cellInfo[$cell]{lastpage})) { return $cell; } } die "Did not find cell.\n";}sub printStatus { foreach $file (sort(keys(%fileStatus))) { $state = $fileStatus{$file}[0]; $cell = $fileStatus{$file}[1]; if ($state == 0) { print "ERROR: nothing done with file $file.\n"; } elsif ($state == 1) { print "CRASH: cell $cell failed to finish its file $file.\n"; } elsif ($state == 2) { print "OK: cell $cell did $file\n"; } elsif ($state == 3) { print "CORRUPT: cell $cell got a corrupt file $file.\n"; } elsif ($state == 4) { print "CORRUPT: master saw corrupt file $file from cell $cell.\n"; } else { print "ASSERT: bad state, script problem!\n"; } $fileStatus{$file}[0] = 0; $fileStatus{$file}[1] = 0; } if ($verbose) { print "\n"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -