%externalroutine anlog(%string (255) s) %externalroutinespec define(%string(255)s) %externalintegerfnspec smaddr(%integer chan, %integername len) %externalstring (*) %fnspec itos(%integer i,j) !nsm %integer next tot, sum, ch, nodeb %integer qtr6, qtr9, hr6, hr9 ,tot6, tot9, hr, min, qtr %integer last6, last9, time6, time9, time %string(3) hrs, mins, secs %integerarray entb(0:1,1:25) %recordformat totf(%integer sum, %byteinteger node, hr, min) %record(totf) %array tot pkts(1:576) !end %integer i,j,k,hmax,m,o,p,q,type,ent,tci,tco,tbi,tbo,tpp,node, tcf, tsm %integer diff, ntime, thr, tmpr %owninteger conns,info, rec, start, max, gsum, maxt %owninteger free ind = 1 %integerarray n,t,co,ci,bo,bi,pp,cf,sm, icf, ism,ssm,scf, mpr, lastt(0:127) %integerarray ompr, mpx, mpp(0:127) %integer line,oline %constbyteintegerarray rubbish(0:15) = %c 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0 %ownintegerarray cou(0:11) %recordformat lf(%integer flag, l0, l1, lastt, lastp, pkt) %record (lf) %name l %record (lf) %array cpa(0:511) %owninteger nextgo, startpoint %recordformat tabf(%integer con, pkt, byt) %record (tabf) %array tab(1:70,1:70) %byteintegerarray nn,tt(1:70) %byteintegerarray nod(1:15, 0:200) %string (6) %array nm(1:70) %switch sw(0:11) %ownintegerarray enta(1:25) %string (255) dates,times,date1,time1,s1,s2 %on 9 %start; -> end; %finish %routine writeproperly(%integer x) %if x < 10 %then printsymbol(x+'0') %elsestart writeproperly(x//10) printsymbol(x-x//10*10+'0') %finish %end %integerfn index(%integer n) %constbyteintegerarray ni(1:4) = 72, 75, 80, 156 %integer i %if n = 0 %start %if node = 64 %then %result = 9 %else %result = 6 %finish %if n<10 %then %result = n %cycle i = 1, 1, 4 %if ni(i) = n %then %result = 9+i %repeat %result = 15 %end %routine add to matrix(%integer n1, t1, n2, t2, bl, bi, bo) %integer i, j, nind, tind, x, y %record (tabf) %name t nind = index(n1) %if n1 = 0 %then n1 = nind x = nod(nind, t1) %if x = 0 %start x = free ind; free ind = free ind+1 %if free ind > 71 %start out: select output(0); printstring("too many destinations ! ") select output(2) %return %finish nod(nind, t1) = x nn(x)=n1; tt(x) = t1 %return %if n2 = -1; ! special to add entries to table %finish nind = index(n2) %if n2 = 0 %then n2 = nind y = nod(nind, t2) %if y = 0 %start y = free ind; free ind = free ind+1 %if free ind > 61 %then -> out nod(nind, t2) = y nn(y) = n2; tt(y) = t2 %finish t == tab(x, y) t_con = t_con+1 t_pkt = t_pkt+bl t_byt = t_byt+bi %if t_con>maxt %then maxt = t_con tab(y, x)_byt = tab(y, x)_byt+bo %end %routine add figs %integer x, y x = sm(line)-ism(line); x=0 %if x<0 ssm(line) = ssm(line)+x y = cf(line)-icf(line); y=0 %if y<0 scf(line) = scf(line)+y ism(line)=0; icf(line)=0 %end %routine initialise %integer i,len start = smaddr(1, len) max = start+len %end %integerfn nextsym %result = byteinteger(start) %end %routine rsymbol(%integername i) i = byteinteger(start); start = start+1 %end %integerfn stoi(%string(*)%name s) %integer i,sum sum=0 %result=0 %if length(s)=0 %cycle i = 1, 1, length(s) sum = sum*10+(charno(s, i)-'0') %repeat %result = sum %end %routine skiptoend %integer i %cycle rsymbol(i); %return %if i=nl %repeat %end %routine readstr(%string(*) %name s, %integer x) %integer i,j s = ""; gsum = 0 %cycle i = nextsym %return %if i = ' ' %or i = nl %or i='-' s = s.tostring(i) gsum = gsum*10+i-'0' %if x # 0 start=start+1 %repeat %end %string (8) %fn print name(%integer n, t) %constinteger no of names = 61 %conststring (8) %array ns(1:no of names) = %c "Tcp a ","Tcp c ","Tcp d ","Tcp m ","Tcp s ","Jcmb ","Engin ", "Chem ","Forest","Igs ","G. sq.","Geog ","A.i. ","Cs-at1","Cs-at2", "Atb-1 ","Atb-2 ","Socs ","Eulib ","Pollck","Bush ","Fcnrs ", "Siae ","Hfro ","Scri ","Ws-coa","Gla1 ","Gla2 ","Gla3 ","Gla4 ", "Gla5 ","Stcl-1","Stcl-2","2972-1","2972-2","2980-0","2980-1","2980-2", "Psse ","Fstore","Cs-vax","2976 ","Node 1","Node 2", "Node 6","Node 9","Node 3","info ","Ap twr","2972 ","2980 ", "XGate ", "Devs ", "2972-4", "Sdvs ","RingGW", "Atb2 ", "Wos-ca", "Scri-P", "ee Vax", "Srsx " %ownbyteintegerarray nt(1:no of names) = 4,2, 47, 8, 13, 15, 60, 20, 154, 66, 40, 26, 43, 41, 89, 27, 70, 42, 63, 67, 83, 34, 62, 65, 33, 35, 52, 53, 55, 56, 57, 50, 52, 9, 75, 180, 181, 182, 5, 90, 78, 9, 0(5), 156, 14, 72, 80, 1, 7, 3, 23,0,9, 1, 6, 84, 3 %ownbyteintegerarray nn(1:no of names) = %c 72, 72, 9, 72, 72, 9, 6, 6, 9, 6, 9, 6, 6, 9, 6, 6(11), 7(2), 2, 7, 2, 3, 3, 72, 9(2), 6, 9, 72, 90, 78, 7, 1, 2, 6, 9, 3, 156, 6, 72, 80, 72, 72, 72, 6, 72, 70, 35, 71, 84, 46 %integer i, j %string (25) s %if n=0 %start %if node = 64 %then n=9 %else n=6 %finish %if line = 0 %then %result = "Ap Twr" %cycle i = 1, 1, no of names %if nt(i) = t %and nn(i) = n %then %result = ns(i) %repeat s = "N".itos(n, 0)."T".itos(t, 0)." " %if length(s) > 6 %then length(s) = 6 %result = s %end %routine out(%integer l,h,q) %integer x, y, z, i, j %record (tabf) %name t %cycle x = 1, 1, 6 spaces(9) %cycle i = l, 1, h printsymbol(charno(nm(i), x)); spaces(3) %repeat newline %repeat newline %cycle i = 1, 1, k printstring(nm(i)) %cycle j = l, 1, h t == tab(i, j) %if q = 0 %then y = t_con %else%start %if q = 1 %then y = t_pkt %else%start %if q = 2 %then y = t_byt %finish %finish %if y=0 %then printstring(" .") %else %start %if q = 2 %start y = (y*16)//1000 %if y = 0 %then printstring(" *") %else %start %if y>=1000 %start write(y//1000, 2); printsymbol('m') %finishelse write(y, 3) %finish %finish %else %start %if y<1000 %then write(y, 3) %else %c write(y//1000, 2) %and printsymbol('k') %finish %finish %repeat newline %repeat %end %cycle i = 1, 1, 70; %cycle j = 1, 1, 70 tab(i, j)=0 %repeat;%repeat %cycle i = 1, 1, 15;%cycle j=0, 1, 200;nod(i,j)=0;%repeat;%repeat %for line=0, 1, 127 %cycle n(line)=-1; co(line)=0;ci(line)=0;bo(line)=0;bi(line)=0;pp(line)=0 cf(line)=0; sm(line)=0; icf(line)=-1; ism(line)=0 ssm(line)=0; scf(line)=0 mpr(line)=0; lastt(line)=99999; ompr(line)=0 mpx(line) = 0; mpp(line) = 0 %repeat %cycle i = 0, 1, 511 cpa(i)_flag = -2; cpa(i)_pkt = 0; cpa(i)_l0 = 0; cpa(i)_l1 = 0 %repeat %if s="" %then s = "logfile" s1="logfile";s2=".out" %if s->s1.("/").s2 %then i=0 define("1,".s1); define("2,".s2) select output(2) initialise times="";dates="" !nsm next tot = 1 %for j = 0, 1, 1 %cycle entb(j, i) = 0 %for i = 1, 1, 25 %repeat !end add to matrix(72,72,-1,0,0,0,0) add to matrix(80,80,-1,0,0,0,0) add to matrix(78,78,-1,0,0,0,0) add to matrix(90,90,-1,0,0,0,0) add to matrix(72, 5,-1,0,0,0,0) cpa(2)_pkt = 0 %cycle %exit %if start>=max readstr(date1, 0); start=start+2 %exit %if start>=max readstr(time1, 0); start=start+1 readstr(s, 0) %if s="N006T000" %or s="N009T000" %start %if s="N009T000" %then node = 64 %else node = 0 %if dates="" %start spaces(30); printstring("First record at:") printstring(date1." "); printstring(time1); newline dates=date1; times=time1 %finish start=start+1; ! a space rsymbol(i); ! a space or NIF %if i # ' ' %then skiptoend %and %continue readstr(s2, 1); type = gsum cou(type) = cou(type)+1 %if type > 1 %start %if rubbish(type) = 0 %start skiptoend; %continue %finish %cycle ent = 1, 1, 25 rsymbol(i) readstr(s2, 1); enta(ent) = gsum %if i='-' %then enta(ent) = 65536-enta(ent) %if nextsym = nl %then %exit %repeat %finish start=start+1; ! the newline line = enta(1)+node; oline = enta(4)+node %if line > 127 %then skiptoend %and %continue rec = rec+1 i = (charno(time1, 1)-'0')*10+charno(time1,2)-'0' j = (charno(time1, 4)-'0')*10+charno(time1,5)-'0' ntime = i*60+j %if startpoint = 0 %then startpoint = ntime+60 %if ntime > nextgo %start nextgo = nextgo+15 mpx(i) = 0 %for i = 0, 1, 127 %cycle i = 0, 1, 511 l == cpa(i) mpx(l_l0) = mpx(l_l0)+l_pkt mpx(l_l1) = mpx(l_l1)+l_pkt l_pkt = 0 %repeat %cycle i = 0, 1, 127 %if mpx(i) > mpp(i) %start printstring(time1); write(i, 6); write(mpp(i), 4); write(mpx(i), 4); newline mpp(i) = mpx(i) %finish %repeat %if startpoint > 0 %and startpoint < ntime %start startpoint = -1 mpp(i) = 0 %for i = 0, 1, 127 %finish %finish -> sw(type) sw(1): ! initialise %if node = 64 %then printstring("Node 9") %else printstring("Node 6") printstring(" reloaded at"); printstring(" ".date1." ".time1) newline %for line = node, 1, node+63 %cycle add figs %repeat !nsm %if node = 0 %then nodeb = 0 %else nodeb = 1 entb(nodeb, i) = 0 %for i = 1, 1, 25 !end -> out sw(3): ! thruput !nsm %if node = 0 %then nodeb = 0 %else nodeb = 1 time1 -> hrs.(":").mins.(":").secs hr = stoi(hrs); min = stoi(mins) enta(8) = enta(8)+enta(9)*1024 enta(9) = 0 enta(14) = enta(14)+enta(15)*1024 enta(15) = 0 enta(20) = enta(20)+enta(21)*1024 enta(21) = 0 sum = 0 %for i = 3, 1, 22 %cycle sum = sum+(enta(i)-entb(nodeb, i)) entb(nodeb, i) = enta(i) %repeat tot pkts(next tot)_sum = sum tot pkts(next tot)_hr = hr; tot pkts(next tot)_min = min tot pkts(next tot)_node = node next tot = next tot+1 %unless next tot >= 576 !end -> out sw(4): ! connect -> out sw(5): ! connect check cc: %if node = 64 %then k = 256 %else k = 0 i = enta(7); l == cpa(i+k) %if l_flag < 0 %start l_l0 = line; l_l1 = oline l_pkt = 0 l_pkt = enta(11) %if l_flag = -1 l_lastt = ntime; l_lastp = enta(11) l_flag = 1 %finishelsestart %if ntime = l_lastt %or enta(11) < l_lastp %then -> out; ! nasty reference l_pkt = l_pkt+enta(11)-l_lastp l_lastt = ntime; l_lastp = enta(11) %finish %if type = 6 %then l_flag = -1 -> out sw(6): ! disconnect conns = conns+1 %unless line = 84 %or oline = 84 %start; ! squash n9<->n6 in n9 %if enta(2) = 156 %then info = info+1 add to matrix(enta(2), enta(3), enta(5), enta(6), enta(11), %c enta(9), enta(10)) %finish ci(oline) = ci(oline)+1 co(line) = co(line)+1 bo(line) = bo(line)+enta(9) bi(line) = bi(line)+enta(10) bi(oline)=bi(oline)+enta(9) bo(oline)=bo(oline)+enta(10) pp(line) = pp(line)+enta(11) pp(oline) = pp(oline)+enta(11) -> cc sw(8): ! attach icf(line)=0; ism(line)=0 sw(9): ! attach check -> out %if enta(2) # n(line) %and n(line) # -1; ! chuck 2nd attach ********** n(line) = enta(2); t(line)=enta(3) -> out %if type = 8 %if icf(line) = -1 %start icf(line) = enta(6); ism(line) = enta(5) %finish %else %start cf(line) = enta(6); sm(line) = enta(5) %if line # 0 %start q=0 %if cf(line) out sw(10): ! remove add figs -> out sw(11): ! line check time1 -> hrs.(":").mins.(":").secs hr = stoi(hrs); min = stoi(mins) ntime = hr*60+min diff = ntime-lastt(line) %if diff > 0 %start thr = (enta(5)-ompr(line))//diff %if mpr(line) < thr %then mpr(line) = thr %finish lastt(line) = ntime; ompr(line) = enta(5) -> out out: %finish %else %start skiptoend %finish %repeat end: ! end-of-file spaces(30); printstring("Last time was: ".date1." ".time1); newline printstring("No of connections was "); write(conns, 1) printstring(" Info made"); write(info, 1) printstring(" of these ") printstring("There were"); write(rec, 4); printstring(" Node records ") printstring(%c "Attach connections k bytes packets Messages Conn fails") printstring(" pkts/sec (line errors trigger) out in out in both bytes/pkt ") tci=0;tco=0;tbi=0;tbo=0;tpp=0; tcf = 0; tsm = 0; tmpr=0 %cycle line = 0, 1, 127 %if line=0 %then printstring("Node 6 ====== ") %and node = 0 %if line = 64 %then printstring(" Node 9 ====== ") %and node = 64 %if n(line)=-1 %then %continue printstring(print name(n(line), t(line))." ") write(co(line), 6); write(ci(line), 6) write(((bo(line)*16)+999)//1000, 8); write(((bi(line)*16+999))//1000, 8) write(pp(line), 8) %if pp(line) = 0 %then print(0, 8, 0) %else %c print((bo(line)+bi(line))*16/pp(line), 8, 0) write(sm(line)-ism(line)+ssm(line), 8) write(cf(line)-icf(line)+scf(line), 8) tsm = tsm+sm(line)-ism(line)+ssm(line) tcf = tcf+cf(line)-icf(line)+scf(line) print(mpr(line)/60, 6, 2) tmpr = tmpr+mpr(line) print(mpp(line)/(15*60), 8, 2) newline tci=tci+ci(line); tco=tco+co(line) tbi=tbi+bi(line); tbo=tbo+bo(line) tpp=tpp+pp(line) %repeat printstring(" Totals ") write(tco, 6); write(tci, 6) write((tbo*16+999)//1000, 8); write((tbi*16+999)//1000, 8) write(tpp, 8) %if tpp=0 %then print(0, 8, 0) %else %c print((tbo+tbi)*16/tpp, 8, 0) write(tsm, 8); write(tcf, 8) print(tmpr/60, 6, 2) newline newpage printstring("Conection Grid Destination ") k = free ind-1 hmax = k hmax = 60 %if k>60; ! only room for 60 in histogram k = 70 %if k > 70 %cycle i = 1, 1, k nm(i) = print name(nn(i), tt(i)) %repeat out(1, 30, 0) newlines(3) out(31, hmax, 0) newpage printstring(" Packets exchanged on Connections from/to ") out(1, 30, 1); newlines(3) out(31, hmax, 1); newlines(5) newpage printstring("k bytes sent from a/b ") out(1, 30, 2); newlines(3) out(31, hmax, 2) newpage !nsm ! %integerfn timediff(%integer hr1, min1, hr2, min2) !result = time1 minus time2 in minutes %if min1 < min2 %then min1 = min1+60 %and hr1 = hr1-1 %if hr1 < hr2 %then hr1 = hr1+24 %result = (hr1-hr2)*60+(min1-min2) %end ! printstring("Histogram of packet rate per second * = node 6 # = node 9 ") qtr6 = tot pkts(1)_min//15*15; qtr9 = qtr6 hr6 = tot pkts(1)_hr; hr9 = hr6 tot6 = 0; tot9 = 0; time6 = 0; time9 = 0; last6 = 1; last9 = 1 %for i = 2, 1, next tot-1 %cycle ch = -1 %if tot pkts(i)_node = 0 %thenstart tot6 = tot6+tot pkts(i)_sum time6 = time6+timediff(tot pkts(i)_hr, tot pkts(i)_min, %c tot pkts(last6)_hr, tot pkts(last6)_min) last6 = i %if tot pkts(i)_min >= qtr6 %and hr6 <= tot pkts(i)_hr < hr6+23 %c %then ch = '*' %finishelsestart tot9 = tot9+tot pkts(i)_sum time9 = time9+timediff(tot pkts(i)_hr, tot pkts(i)_min, %c tot pkts(last9)_hr, tot pkts(last9)_min) last9 = i %if tot pkts(i)_min >= qtr9 %and hr9 <= tot pkts(i)_hr < hr9+23 %c %then ch = '#' %finish %continueif ch < 0 hr = tot pkts(i)_hr; min = tot pkts(i)_min; qtr = min//15*15 printsymbol(hr//10+'0'); printsymbol(hr-hr//10*10+'0') printsymbol(':') printsymbol(min//10+'0'); printsymbol(min-min//10*10+'0') spaces(2) qtr = qtr+15 %if qtr >= 60 %thenstart qtr = 0 hr = hr+1; hr = 0 %if hr >= 24 %finish %if ch = '*' %thenstart qtr6 = qtr; hr6 = hr; time = time6*60; sum = tot6; tot6 = 0; time6 = 0 %finish %if ch = '#' %thenstart qtr9 = qtr; hr9 = hr; time = time9*60; sum = tot9; tot9 = 0; time9 = 0 %finish %if time > 0 %then sum = sum//time %else sum = 0 %if sum <= 1 %thenstart printsymbol(ch) %if sum # 0 %finishelsestart %if sum < 10 %then j = sum-1 %elseif sum < 100 %then j = sum-2 %c %else j = 100-3 printsymbol(ch) %for j = 1, 1, j writeproperly(sum) %finish newline %repeat newlines(5) !end newpage %cycle i = 1, 1, hmax write(i, 2) write(nn(i), 2); write(tt(i), 2); spaces(2) printstring(print name(nn(i), tt(i))) newline %repeat printstring("Analysis of types of Node record ") %cycle i = 0, 1, 11; write(i, 8); %repeat newline %cycle i = 0, 1, 11; write(cou(i), 8); %repeat newlines(15) %end %endoffile