; -*- 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 name,args .call [setz ? sixbit /name/ ? args(400000)] termin beg: move p,[-lpdl,,pdl-1] .open chttyo,[.uao,,'tty ? setz ? setz] .lose syscal sstatu,[repeat 8,[ ? movem nfjobs]] ;# free job slots. .lose %lssys move a,[squoze 0,sloadu] .eval a, .lose hrli a,(a) hrri a,fairsh .getloc a, movei a,10000. idivm a,fairsh 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 count: syscal ttyget,[movei 400000(b) ;D gets TTYST var - negative for repeat 3,[ ? movem d]] ; free tty. jrst print ;Error means we have run out of tty numbers. syscal ttyvar,[movei 400000(b) ? [sixbit/ttytyp/] movem a] .lose %lssys 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: movei a,[asciz /Fair Share = /] pushj p,ascout move a,fairsh pushj p,decout movei a,[asciz /% /] pushj p,ascout 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, fairsh: 0 nfstys: 0 nfjobs: 0 nidle1: 0 nidle5: 0 nidl10: 0 patch:: pat: block 40 epatch: -1 lpdl=10 pdl: block lpdl end beg