%externalroutine dumpgec(%string(63) s) %conststring (25) vsn = " Version 1.3" %owninteger print all = 0; ! prints lau data if <>0 %owninteger mon line = -1; ! line to monitor %owninteger mon con = 0 %owninteger print this = 0 %constinteger our exchange = 1 %owninteger this exchange = 0, fix exch %constinteger scd = 0 %constinteger ecd = 1 %constinteger dcd = 2 %constinteger laustats = 3 %constinteger unitstats = 4 %routinespec dumpaddr(%bytearrayname a, %byte l) %routinespec writehex(%integer n,d) !Routine for dumping GEC Network Management logs %routinespec dat(%integer dat) %routinespec tod(%integer d) %externalroutinespec define(%string(63) s) %externalintegerfnspec smaddr(%integer chan,%integername l) %externalintegerfnspec exist(%string(63) s) %conststring (7) %array units(0:4) = "Max Bf:", "Cur Bf:", "Vcs", "Min Bf:", "Req Dl:" %integer ina,inl,idunit, idexch,idtype, oup %string(63) t,u %owninteger old t = 1 %owninteger atod = 0 %ownintegerarray overdes(1:32) = %c -1(7), 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2 %constinteger low name = -3 %constinteger high name = 35+4+24+11 %constinteger George Sq = 35+4 %constinteger small cpse = 35+4+24 %conststring (6) %array names(low name:high name) = "Spssgw", "Srsx11", "SjanGw", "??????", "2972-2","2972-1", "2988-2", "Xcall ", "Janet ", "CS Vax", "Xgate ", "GScpse", "40cpse", "ERCVax", "JntPad", "StrX25", "TCP M ", "ForrCo", "Scri-i", "Phy #2", "Abro ", "Arcus ", "EE Vax", "Info ", "Forr ", "Jcmb ", "Slow2 ", "PhyVax", "Chem ", "Siae ", "Engin ", "Pollck", "Bush ", "SiaeRS", "IGS ", "Scri-p", "HFRO ", "Wscoa ", "PrcPri", "CsTVax", "MRCVax", "RedPAD", "ESAVax", "Em g-2", "Em g-1", "Bu g-2", "KBcpse", "Mcsu ", "Geac ", "Vax 1", "Vax 2", "Vax 3", "CSa1 ", "CS a2 ", "Atb 1", "Atb 2", "Atb 3", "Geog ", "Elib ", "GSqt 1", "Socs ", "Ersk ", "Ktod ", "GSqt 2", "DVet T", "Lau 23", "Lau 24", "Erte ", "Dev mc", "Lc 03", "DevPAD", "Oslan ", "G/W 3", "Gec 63", "KBcpse", "ZooPad", "Lc 10", "VmDev " %ownintegerarray address(low name:high name) = 71000005, 71000016, 71000004, 11111111, 15000001, 15000002, 15000003, 15000004, 15000099, 15000006, 15000007, 15000008, 15000009, 15000010, 15000011, 15000012, 15000013, 15000016, 15000015, 15000014, 15000017, 15000018, 15000019, 15000020, 15000021, 15000022, 15000023, 15000024, 15000025, 15000026, 15000027, 15000028, 15000029, 15000030, 15000031, 15000032, 15000033, 15000034, 15000035, 15000036, 15000037, 15000038, 15000039, 16000001, 16000002, 16000003, 16000004, 16000005, 16000006, 16000007, 16000008, 16000009, 16000010, 16000011, 16000012, 16000013, 16000014, 16000015, 16000016, 16000017, 16000018, 16000019, 16000020, 16000021, 16000022, 16000023, 16000024, 17000001, 17000002, 17000003, 17000004, 17000005, 17000006, 17000007, 17000008, 17000012, 17000010, 17000011 %integerfn stoi(%string (*) %name s) %integer i, n, k n = 0 %result = 0 %if length(s) = 0 %cycle i = 1, 1, length(s) k = charno(s, i)-'0' %unless 0<=k<=9 %then %result = n n = n*10+k %result = -1 %if n > 150000000 %repeat %result = n %end %routine an options(%string (255) s) %string (63) u printstring("option ="); printstring(s); newline %if s -> s.(":N").u %then old t = 0 %and s = s.u %if s -> s.(":P").u %then print all = 1 %if s -> s.(":L").u %then mon line = stoi(u) %if s -> s.(":C").u %then mon con = 1 %if s -> s.(":E").u %then fix exch = stoi(u) %end %if s->s.(":").t %start %cycle %unless t -> t.(":").u %then %exit an options(":".t) t = u %repeat an options(":".t) %finish %if s->s.("/").t %start %unless t -> t.(",").u %then u="" %finish %else t = ".out" %and u = "" print all = -1 %if u = "" define("1,".s) %if old t # 0 %start ina=smaddr(1,inl) printstring("Length discrepancy ") %and inl = inl & x'ffffff00' %unless inl & 255 = 0 %finish %if u="" %then printall = -1 %and u = ".Null" define("2,".u) define("3,".t) %cycle oup = 2, 1, 3 selectoutput(oup) newpage printstring(" Dump GEC logfile"); printstring(vsn) printstring(" Log:"); printstring(s); printstring(" To:"); printstring(t); newlines(5) %repeat select output(2) ! ! %begin ! %recordformat logf(%integer tod, seqno, %c ((%halfinteger date, exchno) %or %c (%halfinteger l, %byte type, spare1, %integer id, %c (%halfinteger callid, spare, %c ((%bytearray called, caller(0:7), %byte cdl, crl, facs, res, scause, sdiags, spare2, spare3) %c %or (%integer segs tx, segs rx, %halfinteger ints tx, ints rx, res tx, res rx, retries, ecause, ediags)) %c %or (%halfintegerarray l stats(0:11)) %c %or ((%integer oflo, %halfinteger l ctrl rx, l ctrl tx, l 1seg rx, l 2seg rx, %c l 3seg rx, l 4seg rx, l 1seg tx, l 2seg tx, l 3seg tx, l 4seg tx, l frms rx, %c l frms tx, l calls rx, l calls tx, l retries, l ints rx, l ints tx, %c l res rx, l res tx, l sups rx, l sups tx, l fcs rx, l abrts rx, %c l idle errors, ldcd,lshort,lunder,l l2res, %c %integer l bytes rx, l bytes tx %or %halfintegerarray lust(0:42))))) %c )) %recordformat log2f(%integerarray lust(0:42), %c %integer l bytes rx, l bytes tx) %record (logf) %name a %record (logf) %name la, mal %constinteger gate start = 39 %constinteger max lines = 45 %owninteger last tod = 0 %owninteger unitfl, unittotal, maxcalls %owninteger count = 0 %owninteger last item = 0 %ownbyteintegerarray ar(0:511) %constinteger maxad = 60 %ownrecord (logf) %array lastl(0:max lines) %ownrecord (logf) %array max l(0:max lines) %ownrecord (log2f) %array overl(0:max lines) %record (log2f) %name tl %conststring(4) %array types(0:4) = "CON ","END ","CHK ","Link","Unit" %integer l,n,j,i,ll,inla,seq,blkno,laun, ins, free, k, ww %string (14) %array addsou(1:maxad) %string (14) %array addsnk(1:maxad) %ownintegerarray conna(0:maxad,0:maxad) %ownintegerarray connf(0:maxad,0:maxad) %owninteger ptr = 1 %integerarray maxp, maxc, maxd(1:300) %routine dump line figs(%record (logf) %name l) %integer i, n printstring("Dump of Line figs: ") %cycle i = 0, 1, 42 write(i, 2) write(l_lust(i), 8); spaces(5) writehex(l_lust(i), 8) newline %repeat %end %routine clear over %integer n, x %if atod > (23*60+45)*60 %then atod = 0 %cycle n = 1, 1, max lines overl(n) = 0; lastl(n) = 0 lastl(n)_tod = atod %repeat %end %routine check for max(%integer l) %integer rx, tx, rxm, txm, tot, i, x, q, tott mal == max l(l) tott = atod-la_tod %if a_oflo # 0 %start q = a_oflo %cycle i = 1, 1, 32 %if q&1 # 0 %start %if overdes(i) < 0 %start select output(0); printstring("Overflow marker:") writehex(a_oflo, 8); newline printstring("Over ? ") select output(2) printstring(" ************************************************************************** ") printstring("Dump of last record, then current ") dump line figs(la); dump line figs(a) newlines(2) %finishelsestart x = overdes(i) overl(l)_lust(x) = overl(l)_lust(x)+65536 %finish %finish q = q>>1 %repeat %finish rx = a_l frms rx; tx = a_l frms tx rxm = rx-la_l frms rx; txm = tx-la_l frms tx %if rxm < 0 %then rxm = rxm+65536 unit total = unit total+rxm %if tott <= 0 %or tott > 3000 %then %return; ! not a 1/2 hr statistic %if mal_tod = 0 %or rxm > mal_l frms rx %start ! ie, if first max figure OR per sec rate is greater %cycle i = 0, 1, 42 junk2: mal_lust(i) <- a_lust(i)-la_lust(i) %repeat mal_l bytes rx = a_l bytes rx-la_l bytes rx mal_l bytes tx = a_l bytes tx-la_l bytes tx mal_lust(34) = a_lust(34); ! vcs operating mal_tod = atod-la_tod mal_seq no = atod; ! hide actual time here %finish %end %routine print line stats(%record (logf) %name l, %c %record (log2f) %name tl, %integer secs) %integer i,j, tod, z, frx, ftx, rxd, txd, t frx = tl_lust(12); ftx = tl_lust(13); ! l frms rx & l frms tx %if tl_lust(2) > frx %start; ! overflow is missing ! frx = frx+65536; tl_lust(12) = frx %finish %if tl_lust(3) > ftx %start ftx = ftx+65536; tl_lust(13) = ftx; ! gec can miss periods !! %finish rxd = tl_lust(4)+tl_lust(5); txd = tl_lust(8)+tl_lust(9); ! l 1seg rx+l 1seg tx tod = l_tod z=tod-secs; %if z<0 %then z=-z %if (secs>10000 %and z>2000) %or (secs<10000 %and z > 250) %start select output(0) printstring("secs ="); write(secs, 1) printstring(", in tod ="); write(tod, 1); newline tod = secs %if tod=0 select output(3) %finish print(frx/tod, 3, 1) %if frx = 0 %then write(0, 6) %else %c print((tl_lust(2)*100)/frx, 6, 0); printsymbol('%') ! l_ ctrl rx %if ftx = 0 %then write(0, 6) %else %c print((tl_lust(3)*100)/ftx, 6, 0); printsymbol('%') %if rxd = 0 %then write(0, 6) %else %c print((tl_lust(4)*100)/rxd, 6, 0); printsymbol('%') %if txd = 0 %then write(0, 6) %else %c print((tl_lust(8)*100)/txd, 6, 0); ! 1seg tx printsymbol('%') write(tl_lust(14), 6); write(tl_lust(15), 6); ! calls rx, tx write(tl_lust(19)+tl_lust(20), 3); ! res rx, tx print(tl_l bytes rx/tod, 5, 0); print(tl_l bytes tx/tod, 5, 0) j = 0 %cycle i = 35, 1, 42; j = j+tl_lust(i); %repeat write(j, 6) write(frx, 8); write(ftx, 8) write(rxd, 8); write(txd, 8) t = tl_lust(2)*6 j = tl_l bytes rx-t z = tl_lust(4)+tl_lust(5) print(j/z, 3, 0) %unless z = 0 j = tl_l bytes tx-(tl_lust(3)*6) print(j/txd, 3, 0) %unless txd = 0 newline %end %routine heading newline printstring(" Frames Control ") printstring(" 1 seg Calls RESETS Bytes/Sec") printstring(" ERRORS Total Frames Total Data F Av Bytes ") printstring(" Line In/sec %Out %In ") printstring("%Out %In Out In Total Out ") printstring(" In Total Out In Out In Out In ") %end %routine print out(%integer flag) %record (logf) %name l %integer i, j, n, t, rxm, txm, rbm, tbm, tlx, lx, ind heading last l(0) = 0 overl(0) = 0 %if flag = 0 %then t = 24*60*60 %else t = 30*60 %if flag = 2 %then t = last tod %cycle n = 1, 1, max lines %if flag#1 %then l == last l(n) %else l == max l(n) tl == overl(n) %cycle j = 1, 1, 42 tlx = tl_lust(j) lx = l_lust(j) tl_lust(j) = tlx+lx %repeat tl_l bytes rx = l_l bytes rx; tl_l bytes tx = l_l bytes tx overl(0)_l bytes rx = overl(0)_l bytes rx+l_l bytes rx overl(0)_l bytes tx = overl(0)_l bytes tx+l_l bytes tx junk label: %if tl_lust(12)+tl_lust(13) # 0 %start %if n > gate start %then printstring("Gw 01 ") %else %start ind = 0; !KB CPse %if this exchange = 2 %then ind = george sq %if this exchange = 3 %then ind = small cpse printstring(names(n+ind)) spaces(3) %finish print line stats(l, tl, t) %finish ! now add to switch running total %cycle j = 1, 1, 42 overl(0)_lust(j) = overl(0)_lust(j)+tl_lust(j) %repeat %repeat %cycle j = 1, 1, 129; printsymbol('-'); %repeat printstring(" Total: ") last l(0)_tod = t; ! not accurate for max period counts l == last l(0); tl == overl(0) print line stats(l, tl, t) %cycle j = 1, 1, 129; printsymbol('-'); %repeat newlines(5) %end %string (12) %fn gets(%byteintegerarrayname a, %integer l) %integer i, n %string (23) s s = "000000000000" %if l > 12 %then l = 12; ! delete sub-address n = 12-l+1 %if l > 1 %start %cycle i = 0, 1, l>>1-1 charno(s, n) = (a(i)&x'f0')>>4+'0' charno(s, n+1) = (a(i)&x'f')+'0' n = n+2 %repeat %finish %if l&1 # 0 %then charno(s, n) = a(l>>1)>>4+'0' %result = s %end %integerfn find(%string(*) %name s, %string (*) %arrayname addsou) %integer i %cycle i = 1, 1, maxad %if s = addsou(i) %then %result = i %if addsou(i) = "" %start addsou(i) = s; %result = i %finish %repeat addsou(i) = s %result = i %end %routine add conn(%record (logf) %name a) %integer f, t %string (12) ca, cl ca = gets(a_caller, a_crl) cl = gets(a_called, a_cdl) f = find(ca, addsou) t = find(cl, addsnk) %if a_scause = 0 %then conna(f, t) = conna(f, t)+1 %c %else connf(f,t) = connf(f, t)+1 %end %routine print grid(%integerarrayname conna) %integer i, j, maxp %routine p grid2(%integerarrayname conna, %integer a, b) %cycle i = 5, 1, 12 spaces(18) %cycle j = a, 1, b printsymbol(charno(addsnk(j), i)); spaces(3) %repeat newline %repeat spaces(14); printsymbol('-') %for i = 1, 1, 100 newline %cycle i = 1, 1, maxad %exit %if addsou(i) = "" printstring(addsou(i)); spaces(3) %cycle j = a, 1, b n = conna(i, j) %if n = 0 %then printstring(" .") %elsestart %if n>1000 %then write(n//1000, 2) %and printsymbol('k') %c %else write(n, 3) %finish %repeat newline %repeat %end %if free > 29 %start p grid2(conna, 1, 29); newlines(5) p grid2(conna, 30, free) %finish %else %start p grid2(conna, 1, free) %finish newpage %end %integerfn get block into ar %end %for i=1,1, maxad %cycle; addsnk(i) = ""; addsou(i) = ""; %repeat %on 9 %start -> eof %finish %if old t = 0 %then n = 99999 %else %c n = inl >> 9 ;!No of blocks Printstring(" No. Time ") %if old t = 0 %start select input(1) skipsymbol %if nextsymbol='*' %finish seq = -1 blkno = 0 !%for blkno = 0, 1, n-1 %cycle %if old t # 0 %start inla = ina + blkno * 512 %finishelsestart ! %if get block into ar # 0 %then %exit inla = addr(ar(0)); ina = inla %finish this exchange = fix exch %cycle a == record(inla) ins = 0 %if a_seqno = -1 %start newlines(2) spaces(9) ;tod(a_tod) !Initialising log printstring(" Date:") spaces(3) ;dat(a_date) ;spaces(3) ;writehex(a_exchno,4) this exchange = a_exchno %unless fix exch # 0 select output(3) printstring(" Date Covered was:"); dat(a_date) spaces(5); tod(atod) printstring(" Exchange"); write(this exchange, 1); newline print out(0) select output(2) ll = 12 clear over %finishelsestart seq = a_seqno atod = a_tod !Anything else ! inside: ll = a_l -> invalid %if ll = 0 idtype = (a_id >>24) & 255 idexch = (a_id >>16) & 255 idunit = (a_id >>8) & 255 this exchange = idexch %if this exchange = 0 %if seq > 150000 %or ll > x'100' %start invalid: %if a_tod = x'04040404' %then %exit; ! eof (pdp11 eof) select output(0) writehex(inla, 8) printstring(" Invalid Element, skipping ") select output(2) inla = inla+4; -> try again %finish %if count = 0 %start select output(3); printstring("First record at ") tod(atod); newlines(2) select output(2) %finish %else %start %if a_tod - last tod > 30*60 %start; ! gap of more than 30 mins select output(3) printstring(" Time gap: Old time:"); tod(last tod) printstring(", New time:"); tod(a_tod); newlines(2) select output(2) %finish %finish count = count+1 last tod = atod laun = -1 %if idtype&255 = 2 %then laun = idunit %if idtype&255 = 3 %then laun = gate start+idunit print this = 0; ! dont print info %if print all > 0 %or mon line = laun %then print this = 1 %if print this = 0 %and mon con # 0 %then print this = -1 %if print this > 0 %or (print this < 0 %and a_type = scd) %start %if ins = 0 %start write(seq, 5) %if print all > 0 %start printstring(" ("); writehex(seq, 3); printsymbol(')') %finish spaces(3) ;tod(atod) %finish %if print all > 0 %start spaces(3); writehex(inla,8) %finish spaces(2) %if 0 <= a_type <= 4 %then printstring(types(a_type)) %else %c write(a_type, 3) spaces(3) %if idtype & 255 = 2 %start !LAU laun = idunit printstring("LAU") ;writehex(idunit, 2) %if idexch # our exchange %start printsymbol('/'); writehex(idexch, 2) %finishelse spaces(3) %finishelseif idtype = 3 %start !GW printstring(" GW") ;writehex(idunit, 2) %if idexch # our exchange %start printsymbol('/'); writehex(idexch, 2) %finishelse spaces(3) %finishelsestart writehex(a_id, 8) %finish %finish %if a_type = scd %or a_type = ecd %or a_type = dcd %start %if print this = 0 %start %if a_type = scd %then add conn(a) %finishelsestart %if a_type = scd %start ww <- a_callid; write(ww, 5); space add conn(a) dumpaddr(a_caller, a_crl) ;printstring(" -> ") dumpaddr(a_called, a_cdl) space ;writehex(a_facs, 2) ;space ;writehex(a_res, 2) space ;writehex(a_scause, 2) ;space ;writehex(a_sdiags, 2) %finishelsestart %if print this > 0 %start ww <- a_callid; write(ww, 5); space printstring("Segs,Ints,resets (RX/TX):") write(a_segs tx, 5) ;write(a_segs rx, 5) ;write(a_ints tx, 2) write(a_ints rx, 2) ;write(a_res tx, 2) ;write(a_res rx, 2) printstring(", Retran:") write(a_retries, 2) %if a_type = ecd %start space ;writehex(a_ecause, 2) ;printsymbol('/') ;writehex(a_ediags, 2) %finish %finish %finish newline %finish %finishelseif a_type = laustats %start %if print this # 0 %start %if a_l bytes rx+a_l bytes tx = 0 %then printstring(" Zero") %elsestart printstring(" Frms (RX/TX):") write(a_l frms rx, 6); write(a_l frms tx, 6) printstring(", Calls:") write(a_l calls rx, 4); write(a_l calls tx, 4) printstring(", Bytes:") write(a_l bytes rx, 6); write(a_l bytes tx, 6) printstring(" da 1-3"); write(a_l 1segrx, 1) write(a_l 2seg rx, 1); write(a_l 3seg rx, 1) %finish newline %finish %if laun > 0 %start la == lastl(laun) check for max(laun) la = a; ! copy 'current' to 'last' la_tod = atod %finish %finishelseif a_type = unitstats %start %for i = 0, 1, 4 %cycle space; printstring(units(i)) write(a_lust(i), 4) %repeat %if maxcalls < a_lust(2) %then maxcalls = a_lust(2) %if unitfl = 0 %start select output(3) %for i = 0, 1, 4 %cycle spaces(3); printstring(units(i)) write(a_lust(i), 4) %repeat newline select output(2) unit fl = 1 %finish select output(0);; tod(atod); space; write(unit total, 1) print(unit total/(40*60), 5, 1) newline; select output(2) maxc(ptr) = a_lust(2) maxp(ptr) = unit total; maxd(ptr) = atod; ptr = ptr+1 unit total = 0 newline %finish %finish inla = (inla + ll + 10)&x'fffffffc' ! inla = (inla>>2)<<2 ! %if inla > (ina+(blkno+1)*512) %or (inla-ina > last item %c ! %and oldt = 0) %then %exit try again: a == record(inla) ! %if a_tod&x'fff00000'#0 %start; ! sub-record ! inla = inla-8 ! a == record(inla) ! ins = 1; spaces(23) ! -> inside ! the above code is necessary for interpreting a raw ! GEC log file, but in this case it has been tidied up ! by the pdp 11 program, so is always in complete records ! %finish inla = inla+4 %if a_tod = 0; ! skip the zero word %repeat !%repeat eof: select output(3) printstring("Totals to last record ") print out(2) newlines(4) clear over printstring(" Last Record at "); tod(last tod); newlines(2) printstring("Max No. of Calls observed was "); write(maxcalls, 1) newlines(2) printstring("Max period of traffic for each Line ") print out(1) %cycle i = 1, 1, 28 write(i, 2); spaces(2); tod(max l(i)_seq no); newline %repeat newpage free = maxad %cycle i = 1, 1, maxad %if addsnk(i) = "" %and free = maxad %then free = i-1 k = stoi(addsou(i)) l = stoi(addsnk(i)) %cycle j = low name, 1, high name %if k = address(j) %then addsou(i) = " ".names(j) %if l = address(j) %then addsnk(i) = " ".names(j) %repeat %repeat printstring(" Connection Grid from/to ") print grid(conna) printstring("Failed Connection Grid FROM/TO ") print grid(connf) newpage printstring("Histogram of Calls and No of packets through switch ") %cycle i = 1, 1, ptr tod(maxd(i)); space write(maxc(i), 4) print(maxp(i)/(40*60), 5, 0); printstring(" !") k = maxc(i)//5 k = 40 %if k > 40 %cycle j = 1, 1, k; printsymbol('c'); %repeat spaces(40-k) k = int(maxp(i)/(40*60))//2; %if k > 60 %then k = 60 %if k > 0 %start %cycle j = 1, 1, k printsymbol('*') %repeat %finish newline %repeat %end %routine dumpaddr(%bytearrayname add, %byte l) %integer i %if l < 14 %then spaces(14-l) %if l>14 %then l=14; ! horrible ************************************* %if l > 1 %start %for i = 0, 1, l>>1-1 %cycle writehex(add(i), 2) %repeat %finish %if l & 1 # 0 %then writehex(add(l>>1) >> 4, 1) %end %routine tod(%integer secs) %integer hour, min hour = secs//3600 min = (secs - hour*3600)//60 secs = secs - (hour *60 + min)* 60 printsymbol(hour//10 + '0') ;printsymbol(hour - (hour//10)*10 + '0') printsymbol(':') printsymbol(min//10 + '0') ;printsymbol(min - (min//10)*10 + '0') printsymbol(':') printsymbol(secs//10 + '0') ;printsymbol(secs - (secs//10)*10 + '0') %end %routine writehex(%integer n,d) %integer i,j,mask mask=15<<((d-1)<<2) %cycle i=0,1,d-1 j=(n&mask)>>((d-i-1)<<2) ;mask=mask>>4 %if j>9 %then j=j+7 j=j+'0' printsymbol(j) %repeat %end %routine dat(%integer dat) %integer d, m, y d = dat & 31 ;m = (dat>>5) & 15 ;y = (dat>>9) & 63 y = y + 1972 write(d, 2); printsymbol('/') ;write(m, 2) ;printsymbol('/') ;write(y, 4) %end %end %endoffile