Trailing-Edge
-
PDP-10 Archives
-
tops10_tools_bb-fp64a-sb
-
10,7/who/whosum.mac
There are 4 other files named whosum.mac in the archive. Click here to see a list.
TITLE WHOSUM - Summary routines for WHO
SEARCH WHOMAC
$SETUP (WHOSUM)
Comment |
This module provides the entry points for summary collection and
printout. The entry points are WHOSTA to collect summary statistics
and WHOSUM to print summary statistics.
|
ENTRY WHOSTA ;Entry for summary collection
ENTRY WHOSUM ;Entry for summary statistics output
DEFINE ZZ(DEF),<
IRP DEF,<
DEFINE XX(MOD,ABR,MAP,TXT,ERR),<EXP ABR''DEF>
DEF'XXX: MODES
>;END IRP
>;END DEFINE ZZ
ZZ <STA,SUM>
; TABLE OF CONTENTS FOR WHOSUM
;
;
; SECTION PAGE
; 1. Summary statistics routines
; 1.1 WHOSTA - Dispatch to mode statistics routines..... 3
; 1.2 JOBSTA - JOB mode statistics...................... 4
; 1.3 LINSTA - LINE mode statistics..................... 5
; 1.4 NODSTA - NODE mode statistics..................... 6
; 1.5 USRSTA - USER mode statistics..................... 7
; 2. Summary print routines
; 2.1 WHOSUM - Dispatch to mode summary routines........ 8
; 2.2 JOBSUM - JOB mode print routines.................. 11
; 2.3 LINSUM - LINE mode print routines................. 12
; 2.4 NODSUM - NODE mode print routines................. 13
; 2.5 USRSUM - USER node print routines................. 14
; 3. Storage................................................... 15
SUBTTL Summary statistics routines -- WHOSTA - Dispatch to mode statistics routines
WHOSTA: AOS NMATCH ;COUNT TOTAL MATCHES
SKIPGE T1,S.SUMMARY## ;SEE IF /SUMMARY
POPJ P, ;NO--SAVE SOME CPU
CAIN T1,PD.SUM## ;JUST /SUMMARY?
PJRST @STAXXX(M) ;YES--DISPATCH TO MODE SPECIFIC
PUSHJ P,.SAVE1## ;SAVE P1
MOVEI P1,(T1) ;SAVE SUMMARY INDEX
XCT SUMLOD(P1) ;LOAD THE KEY
MOVE T3,SUMROU(P1) ;GET ROUNDING FACTOR
CAIG T3,1 ;DONT BOTHER WITH TRIVAL CASE
JRST WHOST1 ;AS THAT MESSES UP SIXBIT WORDS
ADDI T3,1 ;ROUND ROUNDING FACTOR
LSH T3,-1 ;HALF IT
ADD T1,T3 ;ROUND NUMBER
IDIV T1,SUMROU(P1) ;SCALE DOWN
IMUL T1,SUMROU(P1) ;SCALE UP
WHOST1: ADDI T1,1 ;ALLOW 0 (TURN INTO 1)
PUSHJ P,.HASHA## ;ADD IN TABLE
JFCL ;ALREADY THERE
AOS 1(T1) ;COUNT THEM BY KEY
POPJ P, ;AND RETURN
SUBTTL Summary statistics routines -- JOBSTA - JOB mode statistics
JOBSTA: PUSHJ P,JB$PPG## ;GET PROJECT
HRRZ T2,OPRPPN## ;GET OPR
CAIE T1,(T2) ;OPR?
AOS NUSERS ;NO--COUNT USERS
PUSHJ P,JB$STS## ;GET JOB STATUS
TXNE T1,JS.LOG ;LOGGED IN?
AOS NLOGIN ;YES--COUNT
TXNN T1,JS.SWP ;NOT SWAPPED?
AOSA NNSW ;YES--COUNT NOT SWAPED
AOS NSW ;ELSE COUNT SWAPPED
PUSHJ P,JB$TLN## ;GET TERMINAL
CAIGE T1,0 ;SEE IF DETACHED
AOS NDET ;YES--COUNT
PUSHJ P,JB$BJB## ;GET BATCH
CAIE T1,0 ;IS IT?
AOS NBATCH ;YES--COUNT
PUSHJ P,JB$WSC## ;GET STATES CODE
LDB T1,[POINT 12,T1,11] ;FIRST TWO CHARS
CAIE T1,'^C' ;^C?
CAIN T1,'TI' ;TI?
AOS NTI ;YES--COUNT
CAIN T1,'TO' ;TO?
AOS NTO ;YES--COUNT
PUSHJ P,JB$STA## ;GET STATE BITS
TRNE T1,STATSLEEP## ;SLEEPING?
AOS NSL ;YES--COUNT
TRNE T1,STATLOCK## ;LOCKED?
AOS NLK ;YES--COUNT
TRNN T1,STATACTIVE## ;ACTIVE?
POPJ P, ;NO--RETURN
AOS NACT ;YES--COUNTT
TRNE T1,STATRUN## ;RUNNING?
AOS NRN ;YES--COUNT
TRNE T1,STATIOWAIT## ;I/O WAIT?
AOS NIO ;YES--COUNT
TRNE T1,STATEVENTWAIT## ;EVENT WAIT?
AOS NEW ;YES--COUNT
TRNE T1,STATRWAIT## ;RESOUSE WAIT?
AOS NRW ;YES--COUNT
POPJ P, ;AND RETURN
SUBTTL Summary statistics routines -- LINSTA - LINE mode statistics
LINSTA: PUSHJ P,LB$APC## ;DATA SET?
CAILE T1,1
AOS NDIAL ;COUNT
PUSHJ P,LB$RMT## ;REMOTE?
CAIN T1,0
AOS NLOCAL ;COUNT
PUSHJ P,LB$DSC## ;CARRIER?
CAIE T1,0
AOS NCARRIER ;YES--COUNT
PUSHJ P,LB$JOB## ;JOB?
CAIE T1,0
AOS NUSE ;YES--COUNT
PUSHJ P,LB$SLV## ;SLAVED?
CAIE T1,0
AOS NSLAVE
POPJ P, ;AND RETURN
SUBTTL Summary statistics routines -- NODSTA - NODE mode statistics
; This routine will count up the number of nodes with devices and
; the total number of devices. It is stored in NODCNT with the LH
; of each word being the number of nodes having a given device and
; the RH containing the total number of that device in the entire
; network.
;
NODSTA: PUSHJ P,.SAVE1## ;SAVE P1
MOVE P1,[-NODLEN,,NODTAB] ;AOBJN POINTER TO STORAGE,,SUBR
NODS.1: HRRZ T1,(P1) ;GET A SUBROUTINE
PUSHJ P,(T1) ;GET DEVICE COUNT
TRNN T1,777777 ;ANY OF THIS DEVICE?
JRST NODS.2 ;NO
HRLI T1,1 ;+1 FOR THIS NODE
HLRZ T2,(P1) ;GET STORAGE ADDRESS
ADDM T1,(T2) ;ACCUMUATE
NODS.2: AOBJN P1,NODS.1 ;LOOP
POPJ P, ;ALL DONE
DEFINE XX(NAM),<XWD N'NAM,NB$'NAM##>
NODTAB: OBJECTS
NODLEN==.-NODTAB
SUBTTL Summary statistics routines -- STRSTA - STRUCTURE mode statistics
STRSTA: PUSHJ P,SB$FRE## ;GET BLOCKS FREE
ADDM T1,FREBLK ;ACCUMULATE
PUSHJ P,SB$SAJ## ;GET SINGLE ACCESS JOB NUMBER
SKIPE T1 ;HAVE ONE?
AOS SINGLE ;YES--COUNT IT
POPJ P, ;RETURN
SUBTTL Summary statistics routines -- UNISTA - UNIT mode statistics
UNISTA: POPJ P, ;NONE FOR NOW
SUBTTL Summary statistics routines -- USRSTA - USER mode statistics
USRSTA: POPJ P, ;NONE FOR NOW
SUBTTL Summary print routines -- WHOSUM - Dispatch to mode summary routines
WHOSUM: SKIPGE T1,S.SUMMARY## ;SEE IF /SUMMARY
POPJ P, ;NO--RETURN
SKIPLE S.PRINT## ;ALSO /PRINT?
PUSHJ P,.TCRLF## ;YES--PRETTY UP WITH EXTRA CRLF
PUSHJ P,.SAVE1## ;YES--SAVE P1
MOVEI P1,(T1) ;COPY KEYWORD INDEX
CAIN P1,PD.SUM## ;GENERAL DEFAULT?
PJRST @SUMXXX(M) ;YES--DISPATCH TO MODE SPECIFIC
MOVEI T1,CHRDIR## ;NO--COUNT AND OUTPUT CHARS
PUSHJ P,.TYOCH## ;TELL SCAN
PUSH P,T1 ;AND SAVE OLD
MOVEI L,0 ;CLEAR CHAR COUNTER
MOVE T1,SUMTXT(P1) ;GET TITLE
PUSHJ P,.TSTRG## ;TYPE
SUBI L,2 ;GIVE AN EXTRA SPACE
PUSHJ P,PADIT ;GO PAD IT
MOVE T1,TXTXXX##(M)
PUSHJ P,.TSTRG##
MOVEI T1,"s"
PUSHJ P,.TCHAR##
PUSHJ P,.TCRLF##
MOVEI L,0 ;CLEAR CHAR COUNTER
MOVE T1,SUMTXT(P1) ;GET TITLE
PUSHJ P,.TDSTR ;TYPE
SUBI L,2 ;GIVE AN EXTRA SPACE
PUSHJ P,PADIT ;GO PAD IT
MOVE T1,TXTXXX##(M)
PUSHJ P,.TDSTR
PUSHJ P,.TDASH##
PUSHJ P,.TCRLF##
PUSHJ P,.HSRTI## ;INIT AND SORT
MOVE P2,T1 ;COPY AOBJN WORD
WHOSM2: MOVEI L,0 ;CLEAR CHAR COUNTER
MOVE T1,(P2) ;GET THE KEYWORDD
SUBI T1,1 ;ACCOUNT FOR AOS
MOVEI T3,^D6 ;FIELDWIDTH
XCT SUMPRT(P1) ;PRINT IT
PUSHJ P,PADIT ;GO PAD IT
MOVE T1,1(P2) ;GET ADDR OF COUNT
MOVE T1,1(T1) ;GET COUNT OF JOBS
MOVEI T3,^D5 ;FIELDWIDTH
PUSHJ P,.TDECJ## ;TYPE
PUSHJ P,.TCRLF## ;CRLF
AOBJN P2,.+1 ;LOOP FOR ALL
AOBJN P2,WHOSM2 ;..
PUSHJ P,.TCRLF## ;CRLF
MOVEI L,0 ;CLEAR COUNTER
MOVEI T1,[ASCIZ/Total/] ;GET TEXT
PUSHJ P,.TSTRG## ;TYPE
PUSHJ P,PADIT ;PAD
MOVE T1,NMATCH ;GET TOTAL THINGS
MOVEI T3,^D5 ;FIELDWIDTH
PUSHJ P,.TDECJ## ;TYPE
PUSHJ P,.TCRLF## ;AND CRLF
POP P,.TOUTZ## ;RESTORE SCANS TYPER
PJRST .HSRTE## ;FINISH SORT AND RETURN
PADIT: MOVE T1,SUMWID(P1) ;GET WIDTH
SUBI T1,(L) ;MINUS WHAT WE DID
PJRST .TSPAN## ;PAD AND RETURN
.TDSTR: HRLI T1,(POINT 7,) ;FORM BYTE POINTER
PUSH P,T1 ;SAVE
DSTR.1: ILDB T1,(P) ;GET A CHAR
JUMPE T1,DSTR.2 ;DONE?
CAIE T1," " ;TURN ALL BUT SPACES
MOVEI T1,"-" ;INTO DASHS
PUSHJ P,.TCHAR## ;TYPE
JRST DSTR.1 ;AND LOOP
DSTR.2: POP P,(P) ;TRIM STACK
POPJ P, ;RETURN
DEFINE START(X),<>
DEFINE LEN(X),<>
DEFINE X(KEY,TXT,LOD,PRT,WID,RND<1>),<EXP [ASCIZ |TXT|]>
SUMTXT: SUMMARY
DEFINE X(KEY,TXT,LOD,PRT,WID,RND<1>),<
GLOB LOD
PUSHJ P,LOD
>
SUMLOD::SUMMARY
DEFINE X(KEY,TXT,LOD,PRT,WID,RND<1>),<
GLOB PRT
PUSHJ P,PRT
>
SUMPRT: SUMMARY
DEFINE X(KEY,TXT,LOD,PRT,WID,RND<1>),<DEC RND>
SUMROU: SUMMARY
DEFINE X(KEY,TXT,LOD,PRT,WID,RND<1>),<DEC WID>
SUMWID: SUMMARY
CCORE: PUSHJ P,JB$PPL##
PUSH P,T1
PUSHJ P,JB$PPH##
POP P,T2
ADDI T1,(T2)
POPJ P,
VCORE: PUSHJ P,JB$PVL##
PUSH P,T1
PUSHJ P,JB$PVH##
POP P,T2
ADDI T1,1(T2) ;PLUS UPMP
POPJ P,
YESNO:: CAIE T1,0
SKIPA T1,[[ASCIZ/Yes/]]
MOVEI T1,[ASCIZ/No/]
PJRST .TSTRG##
ONOFF:: CAIE T1,0
SKIPA T1,[[ASCIZ/On/]]
MOVEI T1,[ASCIZ/Off/]
PJRST .TSTRG##
ATTYES::CAIE T1,0
SKIPA T1,[[ASCIZ/Ignore/]]
MOVEI T1,[ASCIZ/Ask/]
PJRST .TSTRG##
TAPC: MOVE T1,[ [ASCIZ/Unknown/]
[ASCIZ/Hardwired/]
[ASCIZ/Data set/]
[ASCIZ/TSN/]
[ASCIZ/Gandalf/]
[ASCIZ/Auto dialer/]
[ASCIZ/Micom/]
[ASCIZ/NRTSER/]
[ASCIZ/LAT/]
[ASCIZ/CTERM/]
[ASCIZ/Unknown/]
[ASCIZ/Unknown/] ](T1)
PJRST .TSTRG##
IFN FTLGNQ,<
TLGNQ:: JUMPG T1,.TDECJ##
JUMPL T1,[MOVEI T1,[ASCIZ/Permission/]
PJRST .TSTRG##]
MOVEI T1,[ASCIZ/ No/]
PJRST .TSTRG##
> ;END IFN FTLGNQ
SUBTTL Summary print routines -- JOBSUM - JOB mode print routines
JOBSUM: MOVEI T1,[ASCIZ/LOGMAX /]
PUSHJ P,.TSTRG##
MOVE T1,LOGMAX##
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/: /]
PUSHJ P,.TSTRG##
MOVE T1,NMATCH
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ assigned, /]
PUSHJ P,.TSTRG##
MOVE T1,NLOGIN
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ logged in, /]
PUSHJ P,.TSTRG##
MOVE T1,NUSERS
MOVEI T2,[ASCIZ/user/]
PUSHJ P,.TPLRS##
MOVEI T1,[ASCIZ/, /]
PUSHJ P,.TSTRG##
MOVE T1,NDET
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ detached, /]
PUSHJ P,.TSTRG##
MOVE T1,NBATCH
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ batched
/]
PUSHJ P,.TSTRG##
MOVEI T1,3
PUSHJ P,.TSPAN##
MOVE T1,NTI
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ typing in, /]
PUSHJ P,.TSTRG##
MOVE T1,NTO
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ typing out, /]
PUSHJ P,.TSTRG##
MOVE T1,NSL
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ sleeping, /]
PUSHJ P,.TSTRG##
MOVE T1,NSW
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ swapped, /]
PUSHJ P,.TSTRG##
MOVE T1,NNSW
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ in core, /]
PUSHJ P,.TSTRG##
MOVE T1,NLK
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ locked
/]
PUSHJ P,.TSTRG##
MOVEI T1,3
PUSHJ P,.TSPAN##
MOVE T1,NACT
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ active: /]
PUSHJ P,.TSTRG##
MOVE T1,NRN
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ running, /]
PUSHJ P,.TSTRG##
MOVE T1,NIO
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ" in I/O wait, "]
PUSHJ P,.TSTRG##
MOVE T1,NEW
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ in event wait, /]
PUSHJ P,.TSTRG##
MOVE T1,NRW
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ in resource wait/]
PUSHJ P,.TSTRG##
PJRST .TCRLF##
SUBTTL Summary print routines -- LINSUM - LINE mode print routines
LINSUM: MOVE T1,MAXLIN## ;GET MAXLIN
ADDI T1,1 ;ACCOUNT FOR SOS
MOVEI T2,[ASCIZ/line/]
PUSHJ P,.TPLRS##
MOVEI T1,[ASCIZ/: /]
PUSHJ P,.TSTRG##
MOVE T1,NMATCH
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ connected, /]
PUSHJ P,.TSTRG##
MOVE T1,NLOCAL
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ local, /]
PUSHJ P,.TSTRG##
MOVE T1,NDIAL
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ dialup, /]
PUSHJ P,.TSTRG##
MOVE T1,NCARRIER
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ powered up,
/]
PUSHJ P,.TSTRG##
MOVE T1,NUSE
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ in use, /]
PUSHJ P,.TSTRG##
MOVE T1,NSLAVE
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ slaved/]
PUSHJ P,.TSTRG##
IFN FTLGNQ,<
TLNN F,(FL.LGNQ)
PJRST .TCRLF##
MOVEI T1,[ASCIZ/, /]
PUSHJ P,.TSTRG##
MOVE T1,LGQCNT##
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ waiting to LOGIN, /]
PUSHJ P,.TSTRG##
MOVE T1,LGQPTL##
PUSHJ P,.TDECW##
MOVEI T1,[ASCIZ/ given permission/]
PUSHJ P,.TSTRG##
> ;END IFN FTLGNQ
PJRST .TCRLF##
SUBTTL Summary print routines -- NODSUM - NODE mode print routines
NODSUM: PUSHJ P,.SAVE2## ;SAVE P1 AND P2
MOVE T1,NMATCH ;GET NUMBER OF NODES
MOVEI T2,[ASCIZ/node/] ;AND ASSOCIATED TEXT
PUSHJ P,.TPLRS## ;TYPE IT
MOVEI T1,[ASCIZ/: /] ;ADD A COLON TO
PUSHJ P,.TSTRG## ;SEPARATE FROM SUMMARY
MOVN P1,OBJ.MX## ;GET -LENGTH OG ANF-10 OBJECT TABLE
HRLZS P1 ;MAKE AN AOBJN POINTER
JRST NODSU2 ;DON'T TYPE A CRLF THE FIRST TIME
NODSU1: PUSHJ P,.TCRLF## ;NEW LINE
MOVEI T1,3 ;OUTPUT
PUSHJ P,.TSPAN## ; SPACES
SKIPA P2,[EXP 6] ;LIST 6 DEVICES PER LINE NOW
NODSU2: MOVEI P2,5 ;LIST 5 DEVICES PER LINE
TRZ F,FR.COMMA ;CLEAR COMMA FLAG
NODSU3: SKIPN NODCNT(P1) ;ANY OF THIS TYPE OF DEVICE?
JRST NODSU4 ;NOPE
MOVEI T1,[ASCIZ |, |] ;INCASE THIS ISN'T THE FIRST TIME
TROE F,FR.COMMA ;BEEN HERE BEFORE?
PUSHJ P,.TSTRG## ;YES
HLRZ T1,NODCNT(P1) ;GET JUST THE COUNT OF NODES
PUSHJ P,.TDECW## ;TYPE COUNT
MOVEI T1,[ASCIZ | with |] ;TYPE
PUSHJ P,.TSTRG## ; SEPARATOR
HRRZ T1,OBJTAB## ;GET POINTER TO ANF-10 OBJECT TABLE
ADDI T1,(P1) ;INDEX INTO IT
HRLZ T1,(T1) ;GET A DEVICE NAME
PUSHJ P,.TSIXN## ;TYPE IT
MOVEI T1,"s" ;INCASE PLURAL
HLRZ T2,NODCNT(P1) ;GET COUNT
CAIE T2,1 ;SINGULAR?
PUSHJ P,.TCHAR## ;NO
AOBJP P1,.TCRLF## ;TYPE A CRLF IF DONE
SOJG P2,NODSU3 ;COUNT DEVICES PER LINE
JRST NODSU1 ;NEED A CRLF
NODSU4: AOBJP P1,.TCRLF## ;TYPE A CRLF IF DONE
JRST NODSU3 ;TRY ANOTHER DEVICE
SUBTTL Summary print routines -- STRSUM - STRUCTURE node print routines
STRSUM: MOVE T1,NMATCH ;GET COUNT OF STRUCTURES
MOVEI T2,[ASCIZ |structure|] ;GET INTRODUCTION
PUSHJ P,.TPLRS## ;TYPE IT
MOVEI T1,[ASCIZ/: /] ;ADD A COLON TO
PUSHJ P,.TSTRG## ;SEPARATE FROM SUMMARY
MOVE T1,FREBLK ;GET NUMBER OF BLOCKS FREE
PUSHJ P,.TDECW## ; FOR ALL STRUCTURES LISTED
MOVEI T1,[ASCIZ | blocks free|]
PUSHJ P,.TSTRG## ;TYPE TEXT
PJRST .TCRLF## ;AND RETURN
SUBTTL Summary print routines -- UNISUM - UNIT mode print routines
UNISUM: MOVE T1,NMATCH
MOVEI T2,[ASCIZ/unit/]
PUSHJ P,.TPLRS##
POPJ P,
SUBTTL Summary print routines -- USRSUM - USER mode print routines
USRSUM: MOVE T1,NMATCH
MOVEI T2,[ASCIZ/user/]
PUSHJ P,.TPLRS##
POPJ P,
SUBTTL Storage
$LOW
ZERC0::!
;Common summary counters
NMATCH::BLOCK 1
NFOUND::BLOCK 1
;JOB mode summary counters
NLOGIN: BLOCK 1
NUSERS: BLOCK 1
NDET: BLOCK 1
NBATCH: BLOCK 1
NTI: BLOCK 1
NTO: BLOCK 1
NSL: BLOCK 1
NRN: BLOCK 1
NNSW: BLOCK 1
NSW: BLOCK 1
NLK: BLOCK 1
NACT: BLOCK 1
NEW: BLOCK 1
NRW: BLOCK 1
NIO: BLOCK 1
;Line mode summary counters
NDIAL: BLOCK 1
NLOCAL: BLOCK 1
NCARRI: BLOCK 1
NUSE: BLOCK 1
NSLAVE: BLOCK 1
;Node mode summary counters
DEFINE XX(NAM),<N'NAM: BLOCK 1>
NODCNT: OBJECTS
;Structure mode summary counters
FREBLK: BLOCK 1
SINGLE: BLOCK 1
ZERC1==:.-1
END