;-*-midas-*- title loadp ;Prints out information on current system load. a=1 b=2 c=3 d=4 e=5 f=6 g=7 h=10 i=11 j=12 k=13 l=14 m=15 n=16 p=17 chttyo==1 define syscal a,b .call [setz ? sixbit/a/ ? b ((setz))] termin beg: move p,[-lpdl,,pdl] .open chttyo,[.uao,,'tty] .lose movei b,0 ;B indexes which tty we are looking at. setzm nfstys ;Initialize counters: # of free stys setzm nidle1 ;# of ttys idle less than 1 minute setzm nidle5 ;# idle less than 5 minutes setzm nidl10 ;# idle less than ten minutes syscal sstatu,[%clout,,trash ? %clout,,trash %clout,,trash ? %clout,,trash %clout,,trash ? %clout,,trash %clout,,trash ? %clout,,nfjobs] ;# free job slots. .lose %lsfil count: syscal ttyget,[%climm,,400000(b) ;D gets TTYST var - negative for free tty. %clout,,a ? %clout,,a ? %clout,,d] jrst print ;Error means we have run out of tty numbers. syscal ttyvar,[%climm,,400000(b) ? [sixbit/ttytyp/] %clout,,a] .lose %lsfil trnn a,%tysty ;If it's a sty, is it free? jrst count1 jumpge d,count1 aos nfstys count1: jumpl d,count2 ;Now count all non-free ttys idle < 1 min, etc. syscal ttyvar,[%climm,,400000(b) ? [sixbit/idltim/] %clout,,a] .lose %lsfil caige a,30.*60. aos nidle1 caige a,30.*60.*5 aos nidle5 caige a,30.*60.*10. aos nidl10 count2: aoja b,count ascout: hrli a,440700 ;If C=1, "#" => "", else => "s" ascou1: ildb b,a jumpe b,cpopj cain b,"# jrst [movei b,"s caie c,1 .iot chttyo,b jrst ascou1] .iot chttyo,b jrst ascou1 decout: move c,a ;leaves number in C. decou1: idivi a,10. hrlm b,(p) skipe a pushj p,decou1 hlrz b,(p) addi b,"0 .iot chttyo,b cpopj: popj p, ;Having collected the data, print it out. print: move a,nidle1 pushj p,decout movei a,[asciz/ user# idle less than 1 minute. /] pushj p,ascout move a,nidle5 sub a,nidle1 pushj p,decout movei a,[asciz/ idle 1 to 5 minutes. /] pushj p,ascout move a,nidl10 sub a,nidle5 pushj p,decout movei a,[asciz/ idle 5 to 10 minutes. /] pushj p,ascout move a,nfstys pushj p,decout movei a,[asciz/ free net port#. /] pushj p,ascout move a,nfjobs pushj p,decout movei a,[asciz/ free job slot#./] pushj p,ascout .logout 1, nfstys: 0 nfjobs: 0 nidle1: 0 nidle5: 0 nidl10: 0 trash: 0 ;Place for the unused values from syscals. pat: patch: block 40 epatch: -1 lpdl=10 pdl: block lpdl end beg