From 3dd6c7109502b4c4ed4dd65683347549a8bc0fae Mon Sep 17 00:00:00 2001 From: Eric Swenson Date: Sat, 10 Dec 2016 18:30:41 -0800 Subject: [PATCH] Added LOADP. --- README.md | 1 + build/build.tcl | 4 ++ src/sysen1/loadp.11 | 139 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 src/sysen1/loadp.11 diff --git a/README.md b/README.md index 02f6a590..efb878ff 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,7 @@ There's a [DDT cheat sheet](doc/DDT.md) for Unix users. - INQUPD, processes INQUIR change requests. - JOBS, list jobs by category. - LISP, lisp interpreter and runtime library (autoloads only). + - LOADP, displays system load. - LOCK, shut down system. - LOOKUP, looks up user info in INQUIR database. - LUSER, request help from registered list of logged-in users diff --git a/build/build.tcl b/build/build.tcl index b4ae47ec..25db23e1 100644 --- a/build/build.tcl +++ b/build/build.tcl @@ -847,6 +847,10 @@ respond "*" ":link sys;ts pb,sys;ts probe\r" respond "*" ":midas sys2;ts gmsgs_sysen1;gmsgs\r" expect ":KILL" +# LOADP +respond "*" ":midas sys2;ts loadp_sysen1;loadp\r" +expect ":KILL" + # ndskdmp tape respond "*" ":link kshack;good ram,.;ram ram\r" respond "*" ":link kshack;ddt bin,.;@ ddt\r" diff --git a/src/sysen1/loadp.11 b/src/sysen1/loadp.11 new file mode 100644 index 00000000..31d5897b --- /dev/null +++ b/src/sysen1/loadp.11 @@ -0,0 +1,139 @@ +; -*- 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