-
Notifications
You must be signed in to change notification settings - Fork 11
/
gocheck
90 lines (85 loc) · 12.3 KB
/
gocheck
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr//bin/perl
use bigint;
my @offs = (0,3,5,7,9,11,15,17,33,35,39,45,47,53,57,59,63,75,77,83);
my %legals = (
2 => [1,5,57,489,4125,35117],
3 => [1,15,489,12675,321689],
19 => [1,176377839,381468772192258129,390125285764888664734203691,374033672392630508524864795662961961,359448796707478853662201398479404356886186983,345681908391253482444700805766256890688374132702150281,332456409626323552089753008110920578989152425860059980776167267,319736046569415960553023346593909692027276993628971883863936977542620829,307502197883843189728145070683195306634715300572715148091618574821423047802111371,295736438538105920753848805101221518347169034846464241638380603304292532634709193160046357,284420866155234999231087007390392444099790919003942969485429344438762552097336795489845181754603195,273538254349547522259589180544472876860684075817857666308521432524590908173589166299381140508333672348231869,263072036883964825093321085743751624592085890795667877968046914722839766002860060188356044538992936620738346077533371,253006281532576453382590877761237615086708861593042289202522301490010243250555590112007735795468718567589774511008063937101981,243325665673703086779483164699776334863653761239608010895221752077059186635289648588694650419857894777881877451704872426644446631397547,234015452963882018736875664431930231575827140398694847657266616194101746493170926436132593907169134296767239208215341305209205413117620066366669,undef,216450089279078275314395453480468424469694873576469893709517750563261490751122922463339745178577954008324586419548071995019779454584564790800309660950831580481393]
);
my %sizes = (
'(00,01)'=>'2','(00,02)'=>5,'(00,03)'=>14,'(00,04)'=>41,'(00,05)'=>122,'(00,06)'=>365,'(00,07)'=>1094,'(00,08)'=>3281,'(00,09)'=>9842,'(00,10)'=>29525,'(00,11)'=>88574,'(00,12)'=>265721,'(00,13)'=>797162,'(00,14)'=>2391485,'(00,15)'=>7174454,'(00,16)'=>21523361,'(00,17)'=>64570082,'(00,18)'=>193710245,
'(01,00)'=>581130734,'(01,01)'=>968551224,'(01,02)'=>1248354915,'(01,03)'=>1549681979,'(01,04)'=>1872532447,'(01,05)'=>2247198571,'(01,06)'=>2687763949,'(01,07)'=>3209021823,'(01,08)'=>3829725502,'(01,09)'=>4570570769,'(01,10)'=>5455611910,'(01,11)'=>6513369915,'(01,12)'=>7778250701,'(01,13)'=>9293295015,'(01,14)'=>11117241273,'(01,15)'=>13346673297,'(01,16)'=>16191686752,'(01,17)'=>20242633946,'(01,18)'=>27420640118,
'(02,00)'=>21522651307,'(02,01)'=>30986308034,'(02,02)'=>31298623903,'(02,03)'=>31693832491,'(02,04)'=>32408870046,'(02,05)'=>33278325617,'(02,06)'=>34338606328,'(02,07)'=>35581728837,'(02,08)'=>37004817149,'(02,09)'=>38608152181,'(02,10)'=>40386888039,'(02,11)'=>42334433531,'(02,12)'=>44442197991,'(02,13)'=>46701574497,'(02,14)'=>49105278599,'(02,15)'=>51605344588,'(02,16)'=>54143854082,'(02,17)'=>57213368302,'(02,18)'=>61228340733,
'(03,00)'=>40881769487,'(03,01)'=>58002999560,'(03,02)'=>59334643238,'(03,03)'=>60469963159,'(03,04)'=>63341146488,'(03,05)'=>66835578587,'(03,06)'=>70817218968,'(03,07)'=>75287241359,'(03,08)'=>80230806554,'(03,09)'=>85648500896,'(03,10)'=>91526942570,'(03,11)'=>97839307034,'(03,12)'=>104532220425,'(03,13)'=>111512278630,'(03,14)'=>118534637438,'(03,15)'=>125343428114,'(03,16)'=>132606308733,'(03,17)'=>136916149852,'(03,18)'=>141914020432,
'(04,00)'=>94749641144,'(04,01)'=>133279673599,'(04,02)'=>139475100234,'(04,03)'=>141337328283,'(04,04)'=>144710831678,'(04,05)'=>148463045197,'(04,06)'=>153069890888,'(04,07)'=>157891441076,'(04,08)'=>162699042295,'(04,09)'=>167714036302,'(04,10)'=>172999689254,'(04,11)'=>178512937536,'(04,12)'=>184220151924,'(04,13)'=>190076722087,'(04,14)'=>196151814939,'(04,15)'=>202360200132,'(04,16)'=>207474013378,'(04,17)'=>210314119474,'(04,18)'=>217081706879,
'(05,00)'=>148078845223,'(05,01)'=>207211638983,'(05,02)'=>216469548060,'(05,03)'=>217564698754,'(05,04)'=>219659383053,'(05,05)'=>222577472541,'(05,06)'=>227080995823,'(05,07)'=>231946491708,'(05,08)'=>236515540795,'(05,09)'=>240846330390,'(05,10)'=>245246997565,'(05,11)'=>249759484707,'(05,12)'=>254331499560,'(05,13)'=>259141957250,'(05,14)'=>264141066009,'(05,15)'=>267785483556,'(05,16)'=>270766140299,'(05,17)'=>272186263424,'(05,18)'=>279883445920,
'(06,00)'=>191634190512,'(06,01)'=>266418725693,'(06,02)'=>277107749242,'(06,03)'=>276997911020,'(06,04)'=>278305221847,'(06,05)'=>280377167219,'(06,06)'=>283085518412,'(06,07)'=>286113198756,'(06,08)'=>289386617588,'(06,09)'=>292416290300,'(06,10)'=>295283858296,'(06,11)'=>298149543291,'(06,12)'=>301273797588,'(06,13)'=>304572612860,'(06,14)'=>307391975927,'(06,15)'=>309400710943,'(06,16)'=>311317808475,'(06,17)'=>310340847804,'(06,18)'=>318806979276,
'(07,00)'=>218995042180,'(07,01)'=>303087104611,'(07,02)'=>314503969042,'(07,03)'=>313662246123,'(07,04)'=>314762981544,'(07,05)'=>315408008298,'(07,06)'=>316767074988,'(07,07)'=>318238137665,'(07,08)'=>320224501295,'(07,09)'=>322197332637,'(07,10)'=>324074981108,'(07,11)'=>325954949273,'(07,12)'=>327989551602,'(07,13)'=>329635377133,'(07,14)'=>330993451400,'(07,15)'=>331898195487,'(07,16)'=>332652460063,'(07,17)'=>331412227798,'(07,18)'=>340203429309,
'(08,00)'=>234124268177,'(08,01)'=>323226593080,'(08,02)'=>335060999417,'(08,03)'=>333697753413,'(08,04)'=>334471818410,'(08,05)'=>334752773774,'(08,06)'=>335208185740,'(08,07)'=>335929311404,'(08,08)'=>336795620285,'(08,09)'=>337789906500,'(08,10)'=>338993103472,'(08,11)'=>340193842537,'(08,12)'=>341208451150,'(08,13)'=>341940704916,'(08,14)'=>342543120534,'(08,15)'=>342538499086,'(08,16)'=>343188781762,'(08,17)'=>341751955128,'(08,18)'=>350679355757,
'(09,00)'=>241673515350,'(09,01)'=>333167061729,'(09,02)'=>345100285717,'(09,03)'=>343429348231,'(09,04)'=>344002347891,'(09,05)'=>344016002922,'(09,06)'=>344298982782,'(09,07)'=>344475408752,'(09,08)'=>344862133870,'(09,09)'=>345351284908,'(09,10)'=>346068565995,'(09,11)'=>346710855084,'(09,12)'=>347206796840,'(09,13)'=>347493790247,'(09,14)'=>347679462003,'(09,15)'=>347576129627,'(09,16)'=>348165730611,'(09,17)'=>346625205197,'(09,18)'=>355613593336,
'(10,00)'=>245242658623,'(10,01)'=>337826240069,'(10,02)'=>349793193279,'(10,03)'=>347970724609,'(10,04)'=>348455997738,'(10,05)'=>348327907440,'(10,06)'=>348495476351,'(10,07)'=>348594984428,'(10,08)'=>348779472522,'(10,09)'=>349054285836,'(10,10)'=>349369697983,'(10,11)'=>349633512593,'(10,12)'=>349885925871,'(10,13)'=>349949866206,'(10,14)'=>350109383494,'(10,15)'=>349961500715,'(10,16)'=>350522860550,'(10,17)'=>348932029715,'(10,18)'=>357956392879,
'(11,00)'=>246962976442,'(11,01)'=>340053233207,'(11,02)'=>352024121766,'(11,03)'=>350128366347,'(11,04)'=>350571574550,'(11,05)'=>350383640764,'(11,06)'=>350510537098,'(11,07)'=>350560649308,'(11,08)'=>350710601226,'(11,09)'=>350812542243,'(11,10)'=>350923034713,'(11,11)'=>350993085357,'(11,12)'=>351086512055,'(11,13)'=>351112483197,'(11,14)'=>351264196100,'(11,15)'=>351101834089,'(11,16)'=>351655360866,'(11,17)'=>350042561876,'(11,18)'=>359082635406,
'(12,00)'=>247796629393,'(12,01)'=>341124967266,'(12,02)'=>353094820898,'(12,03)'=>351164800860,'(12,04)'=>351590999371,'(12,05)'=>351379919728,'(12,06)'=>351494355594,'(12,07)'=>351513381198,'(12,08)'=>351596224834,'(12,09)'=>351632029614,'(12,10)'=>351659922386,'(12,11)'=>351658602241,'(12,12)'=>351700745304,'(12,13)'=>351686903225,'(12,14)'=>351824763545,'(12,15)'=>351655877280,'(12,16)'=>352209007602,'(12,17)'=>350587588187,'(12,18)'=>359636018006,
'(13,00)'=>248211427537,'(13,01)'=>341655657833,'(13,02)'=>353623351466,'(13,03)'=>351678282495,'(13,04)'=>352099870689,'(13,05)'=>351878964253,'(13,06)'=>351979735286,'(13,07)'=>351965905489,'(13,08)'=>352004593723,'(13,09)'=>352003013370,'(13,10)'=>352015943910,'(13,11)'=>352001153229,'(13,12)'=>352029690268,'(13,13)'=>351994000228,'(13,14)'=>352111045562,'(13,15)'=>351931982198,'(13,16)'=>352484840812,'(13,17)'=>350860224857,'(13,18)'=>359914224002,
'(14,00)'=>248422212017,'(14,01)'=>341923972545,'(14,02)'=>353890884197,'(14,03)'=>351939805957,'(14,04)'=>352359674275,'(14,05)'=>352130360229,'(14,06)'=>352211989025,'(14,07)'=>352174274203,'(14,08)'=>352196747672,'(14,09)'=>352182686884,'(14,10)'=>352194771085,'(14,11)'=>352180752471,'(14,12)'=>352205953838,'(14,13)'=>352164479020,'(14,14)'=>352267455988,'(14,15)'=>352077215630,'(14,16)'=>352626286940,'(14,17)'=>350999506190,'(14,18)'=>360056963435,
'(15,00)'=>248531705261,'(15,01)'=>342063166832,'(15,02)'=>354030005316,'(15,03)'=>352075521562,'(15,04)'=>352491439019,'(15,05)'=>352252761231,'(15,06)'=>352321906700,'(15,07)'=>352273768440,'(15,08)'=>352291511162,'(15,09)'=>352275891328,'(15,10)'=>352287842674,'(15,11)'=>352273051340,'(15,12)'=>352299671322,'(15,13)'=>352255688522,'(15,14)'=>352355476035,'(15,15)'=>352159241231,'(15,16)'=>352702347809,'(15,17)'=>351072356070,'(15,18)'=>360131127904,
'(16,00)'=>248589058035,'(16,01)'=>342135588427,'(16,02)'=>354102174482,'(16,03)'=>352145029828,'(16,04)'=>352555832038,'(16,05)'=>352309898707,'(16,06)'=>352374868712,'(16,07)'=>352323490235,'(16,08)'=>352340791462,'(16,09)'=>352324592596,'(16,10)'=>352336482655,'(16,11)'=>352321320712,'(16,12)'=>352348020402,'(16,13)'=>352304088024,'(16,14)'=>352403397452,'(16,15)'=>352205509111,'(16,16)'=>352744736166,'(16,17)'=>351111749433,'(16,18)'=>360170162896,
'(17,00)'=>248618924364,'(17,01)'=>342173011235,'(17,02)'=>354139124657,'(17,03)'=>352179338446,'(17,04)'=>352586570037,'(17,05)'=>352337407064,'(17,06)'=>352401190995,'(17,07)'=>352349235273,'(17,08)'=>352366473402,'(17,09)'=>352350010140,'(17,10)'=>352361890858,'(17,11)'=>352346480842,'(17,12)'=>352373213026,'(17,13)'=>352329061721,'(17,14)'=>352428714485,'(17,15)'=>352230121385,'(17,16)'=>352768603091,'(17,17)'=>351133936912,'(17,18)'=>360191168594,
'(18,00)'=>248634546594,'(18,01)'=>342192554873,'(18,02)'=>354157792726,'(18,03)'=>352195509930,'(18,04)'=>352601444323,'(18,05)'=>352351177575,'(18,06)'=>352414785388,'(18,07)'=>352362630042,'(18,08)'=>352379877582,'(18,09)'=>352363279676,'(18,10)'=>352375155506,'(18,11)'=>352359619567,'(18,12)'=>352386347842,'(18,13)'=>352342088102,'(18,14)'=>352441794904,'(18,15)'=>352243131100,'(18,16)'=>352781570264,'(18,17)'=>351146397205,'(18,18)'=>360202638939,
'(19,00)'=>248642685327,'(19,01)'=>342202592286,'(19,02)'=>354167015484,'(19,03)'=>352203375742,'(19,04)'=>352608859555,'(19,05)'=>352358282144,'(19,06)'=>352421846139,'(19,07)'=>352369603470,'(19,08)'=>352386839723,'(19,09)'=>352370189958,'(19,10)'=>352382058119,'(19,11)'=>352366455310,'(19,12)'=>352393174752,'(19,13)'=>352348845899,'(19,14)'=>352448557416,'(19,15)'=>352249844081,'(19,16)'=>352788378391,'(19,17)'=>351152965440,'(19,18)'=>360209069893
);
my %cell;
my ($width,$modidx, $pref) = @ARGV;
if (defined $modidx) {
$pref //= '';
@ARGV = glob("$width.$modidx/yx.$pref*/cpu.*");
die "No logs found in $width.$modidx" unless @ARGV;
} else {
while(<>) {
last if ($width,$modidx) = /\/start (\d+) (\d+)$/;
}
}
my $mod = 2**64-$offs[$modidx];
print "width $width idx $modidx mod $mod\n";
while(<>) {
my ($yx,$size,$ax,$xsize) = /^(\S+) size (\d+) (avg|xsize) (\S+) mod \d+$/;
next if $yx eq '(0,0)';
$yx =~ s/\b(\d)\b/0\1/g;
if ($xsize) {
if ($ax ne 'xsize') {
$xsize = 1;
}
$cell{$yx}->{size} += $size;
$cell{$yx}->{xsize} += $xsize;
}
my ($newill,$needy,$legal,$yx) = /^newillegal (\d+) needy (\d+) legal (\d+) at (\S+)$/;
if ($yx) {
$yx =~ s/\b(\d)\b/0\1/g;
$cell{$yx} //= {size=>0,xsize=>0,newill=>0,needy=>0,legal=>0,parts=>0};
$cell{$yx}->{newill} = ($cell{$yx}->{newill} + $newill) % $mod;
$cell{$yx}->{needy} = ($cell{$yx}->{needy} + $needy) % $mod;
$cell{$yx}->{legal} = ($cell{$yx}->{legal} + $legal) % $mod;
$cell{$yx}->{parts}++;
}
}
my $prevnlstates = 1;
my $prevparts = 1;
for my $yx (sort keys %cell) {
next unless $cell{$yx}->{size};
my $nlstates = $cell{$yx}->{needy}+$cell{$yx}->{legal};
my $nstates = $cell{$yx}->{newill} + $nlstates;
my $diff = abs(($nstates - 3*$prevnlstates) % $mod);
print "parts changed from $prevparts to $cell{$yx}->{parts}\n" unless $prevparts == $cell{$yx}->{parts};
# print "$yx newillegal $cell{$yx}->{newill} needy $cell{$yx}->{needy} legal $cell{$yx}->{legal}\n";
my $cmpsize = $width==19 && defined($sizes{$yx}) && $sizes{$yx} ne $cell{$yx}->{size} ? "!=$sizes{$yx}" : '';
print "$yx size $cell{$yx}->{size}$cmpsize xsize $cell{$yx}->{xsize} diff $diff\n";
$prevnlstates = $nlstates;
$prevparts = $cell{$yx}->{parts};
}
print "\n";;
for my $yx (sort grep { /,00/ } keys %cell) {
my ($y) = $yx =~ /(\d+),/;
my $lw = $legals{$width};
$diff = defined($lw) && defined $lw->[$y] ? abs($cell{$yx}->{legal} % $mod - $lw->[$y]%$mod) : '?';
print "$yx legal $cell{$yx}->{legal} diff $diff\n";
}