From:	SMTP%"turion@research.ptt.nl" 21-MAR-1994 16:40:03.32
To:	EVERHART
CC:	
Subj:	part 5 status tool

X-Newsgroups: comp.os.vms
From: turion_s@dnlts0research.ptt.nl. (Paul Turion)
Subject: part 5 status tool
Message-ID: <1994Mar21.144128.1076@news.research.ptt.nl>
Sender: turion_s@research.ptt.nl (Paul Turion)
Nntp-Posting-Host: dnlts0.research.ptt.nl
Reply-To: turion@research.ptt.nl
Organization: PTT Research
X-Newsreader: mxrn 6.18-4
Date: Mon, 21 Mar 1994 14:41:28 GMT
Lines: 455
To: Info-VAX@CRVAX.SRI.COM
X-Gateway-Source-Info: USENET


-- 
 ------- --------------------  			Paul Turion 
| p t t |  r e s e a r c h   |			The Netherlands
|      _|                    | 			e-mail address
|    _|_|   .  .  .  .  .    |			P.Turion@research.ptt.nl
|___|_|      
My interest is in the future because
I am going to spend the rest of my life there.
-+-+-+-+-+-+-+-+ START OF PART 5 -+-+-+-+-+-+-+-+
X`009`009`009`009`009`009;VMS kernel via the timer q
X`009`009`009`009`009`009;and is entered by JSB when
X`009`009`009`009`009`009;each 1 sec. interval ends.
X`009`009`009`009`009`009;R0-R4 are available
X
X.If`009DF,EVAX
X
X`009.JSB_Entry Input=<R3,R4,R5>,-
X`009`009   Scratch=<R0,R1,R2>,-
X`009`009   Output=<R5>
X.Endc
X;---
X; See if we are supposed to abort
X;---
X`009TSTL`009STOPPING
X`009BEQL`00910$
X.IF`009DF,VMS_V4
X`009MOVAL`009@#EXE$AL_TQENOREPT,R5
X.IFF
X`009MOVL`009G`094EXE$AR_TQENOREPT,R5
X.ENDC
X`009CLRL`009RUNNING
X`009RSB
X10$:
X`009PUSHR`009#`094M<R10,R11>
X
X`009CLRL`009R2`009`009`009`009;Initialize the run count=0
X;+ ---
X; Check the run queues for the number of processes in 'COM' state
X;- ---
X`009CLRL`009R1`009`009`009`009;Initialize summary word pos=0
X
X.IF`009DF,VMS_V4
X`009DSBINT`009#IPL$_SYNCH
X.IFF
X`009LOCK`009SCHED
X.ENDC
X.IF`009DF,VMS_V15
X`009BICL3`009PRIORITY_MASK,@#SCH$GQ_Comqs,R4 ;Get masked queues
X.IFF
X`009BICL3`009PRIORITY_MASK,@#SCH$GL_Comqs,R4 ;Get masked queues
X.ENDC
XFind_Comq:`009`009`009`009`009;Find a run queue with entries
X`009SUBL3`009R1,#32,R0`009`009`009;Calculate #bits left (32-R1)
X`009FFS`009R1,R0,R4,R1`009`009`009;Look for an active queue
X`009BEQL`009Ncomo`009`009`009`009;None: look for procs waiting
X`009`009`009`009`009`009;`009for inswap
X`009MOVAQ`009@#SCH$AQ_Comh`091R1`093,R0`009`009;Got one: get its queue heade
Vr
X`009MOVL`009R0,R3`009`009`009`009;Save terminating address
X
X10$:`009MOVL`009(R0),R0`009`009`009`009;Get the next process in the q
X`009CMPL`009R0,R3`009`009`009`009;End of queue?
X`009BEQL`00920$`009`009`009`009;Yes: look for next queue
X`009INCL`009R2`009`009`009`009;No: count this process
X`009BRB`00910$`009`009`009`009;and try the next one
X
X20$:`009INCL`009R1`009`009`009`009;Queue done, look for next one
X`009BRB`009Find_Comq
X
X;+ ---
X; Check the COMO queues for the number of processes in 'COM' state (outswap)
X;- ---
XNcomo:`009CLRL`009R1`009`009`009`009;Initialize summary word pos=0
X.IF`009DF,VMS_V15
X`009BICL3`009PRIORITY_MASK,@#SCH$GQ_Comoqs,R4 ;Get masked queues
X.IFF
X`009BICL3`009PRIORITY_MASK,@#SCH$GL_Comoqs,R4 ;Get masked queues
X.ENDC
XFind_Comoq:`009`009`009`009`009;Find a run queue with entries
X`009SUBL3`009R1,#32,R0`009`009`009;Calculate #bits left (32-R1)
X`009FFS`009R1,R0,R4,R1`009`009`009;Look for an active queue
X`009BEQL`009Nwait`009`009`009`009;None: look for procs waiting
X`009`009`009`009`009`009;`009for resources
X`009MOVAQ`009@#SCH$AQ_Comoh`091R1`093,R0`009`009;Got one: get its queue head
Ver
X`009MOVL`009R0,R3`009`009`009`009;Save terminating address
X
X10$:`009MOVL`009(R0),R0`009`009`009`009;Get the next process in the q
X`009CMPL`009R0,R3`009`009`009`009;End of queue?
X`009BEQL`00920$`009`009`009`009;Yes: look for next queue
X`009INCL`009R2`009`009`009`009;No: count this process
X`009BRB`00910$`009`009`009`009;and try the next one
X
X20$:`009INCL`009R1`009`009`009`009;Queue done, look for next one
X`009BRB`009Find_Comoq
X
X;+ ---
X; Count processes in collided page wait
X;- ---
XNwait:
X`009MOVAQ`009@#SCH$GQ_Colpgwq,R0`009`009;Get the collided page wait q
X
X10$:`009MOVL`009(R0),R0`009`009`009`009;Get the next process in the q
X`009CMPL`009R0,#SCH$GQ_Colpgwq`009`009;End of queue?
X`009BEQL`009Npfw`009`009`009`009;Yes: look at page fault waits
X`009INCL`009R2`009`009`009`009;No: count this process
X`009BRB`00910$`009`009`009`009;and try the next one
X
X;+ ---
X; Count processes in page fault wait
X;- ---
XNpfw:
X`009MOVAQ`009@#SCH$GQ_PfwQ,R0`009`009;Get the page fault wait q
X
X10$:`009MOVL`009(R0),R0`009`009`009`009;Get the next process in the q
X`009CMPL`009R0,#SCH$GQ_Pfwq`009`009`009;End of queue?
X`009BEQL`009Nfpw`009`009`009`009;Yes: look at free page waits
X`009INCL`009R2`009`009`009`009;No: count this process
X`009BRB`00910$`009`009`009`009;and try the next one
X
X;+ ---
X; Count processes in free page wait
X;- ---
XNfpw:
X`009MOVAQ`009@#SCH$GQ_FpgwQ,R0`009`009;Get the free page wait q
X
X10$:`009MOVL`009(R0),R0`009`009`009`009;Get the next process in the q
X`009CMPL`009R0,#SCH$GQ_Fpgwq`009`009;End of queue?
X`009BEQL`009Count_Done`009`009`009;Yes: all done
X`009INCL`009R2`009`009`009`009;No: count this process
X`009BRB`00910$`009`009`009`009;and try the next one
X
XCount_Done:
X.IF`009DF,VMS_V4
X`009ENBINT
X.IFF
X`009UNLOCK`009SCHED
X.ENDC
X.IF`009DF,VMS_V4
X;
X;   Adjust for the NULL job, which might be missing if the mask
X;   exclused the priority 0 queue.
X;
X`009BBS`009#31,PRIORITY_MASK,10$
X`009DECL`009R2`009`009`009`009; SUBTRACT THE NULL JOB
X10$:
X;
X;   Adjust for the CURrent job if the priority is high enough.
X;
X`009BBS`009@#SCH$GB_PRI,PRIORITY_MASK,20$
X`009INCL`009R2`009`009`009`009; ADD THE CURRENT JOB
X20$:
X.ENDC
X.IF`009DF,VMS_V4
X`009MOVL`009G`094SCH$GB_PRI,R3
X`009MOVL`009#1,R4
X.IFF
X;
X;   Count done, now scan through each CPU. Store the LOWEST priority
X;   found and the number of executing CPUs.
X;
X`009CLRL`009R3`009`009`009`009; Lowest priority
X`009CLRL`009R4`009`009`009`009; Number of CPUs active
X`009CLRL`009R1`009`009`009`009; Current CPU index
X11$:`009SUBL3`009R1,#32,R0`009`009`009;Calculate #bits left (32-R1)
X`009FFS`009R1,R0,@#SMP$GL_ACTIVE_CPUS,R1`009;Look for an active CPU
X`009BEQL`00935$
X15$:`009MOVL`009g`094SMP$GL_CPU_DATA`091R1`093,R0`009; Get the CPU database
X`009BEQL`00930$`009`009`009`009; This CPU doesn't exist
X`009INCL`009R4`009`009`009`009; Seen one more CPU
X`009CMPL`009CPU$L_CURPCB(R0),@#SCH$AR_NULLPCB ; Running 'the null job'?
X`009BEQL`00920$
X.If`009DF,EVAX
X`009PUSHL`009CPU$L_CUR_PRI(R0)
X.Iff
X`009MOVZBL`009CPU$B_CUR_PRI(R0),-(SP)
X.Endc
X`009BBS`009(SP)+,PRIORITY_MASK,20$`009`009; but priority is 'masked'
X`009INCL`009R2`009`009`009`009; CPU is active.
X.If`009DF,EVAX
X20$:`009CMPB`009CPU$L_CUR_PRI(R0),R3`009`009; Store the lowest executing pri
Vority
X.Iff
X20$:`009CMPB`009CPU$B_CUR_PRI(R0),R3`009`009; Store the lowest executing pri
Vority
X.Iftf
X`009BLEQU`00930$
X.Ift
X`009MOVB`009CPU$L_CUR_PRI(R0),R3
X.Iff
X`009MOVB`009CPU$B_CUR_PRI(R0),R3
X.Endc
X30$:`009INCL`009R1
X`009BRB`00911$`009`009`009`009; Check for all 32 CPUs.
X35$:
X.ENDC
X
X;+ ---
X; Count done, calculate the load ave.
X;- ---
X`009ASHL`009#SCALE_FACTOR_SHIFT,R2,R2`009;Scaled process count
X`009DIVL2`009R4,R2`009`009`009`009;Scaled process count/CPUs
X; 1 min. load ave.
X`009EMUL`009M1,F1,#0,R10
X`009EMUL`009R2,F11,#0,R0`009`009`009;R0/R1 quadword
X`009ADDL2`009R10,R0
X`009ADWC`009R11,R1
X`009ASHQ`009#-SCALE_FACTOR_SHIFT,R0,R0`009;Divide by scale factor
X`009MOVL`009R0,M1
X; 5 min. load ave.
X`009EMUL`009M5,F2,#0,R10
X`009EMUL`009R2,F12,#0,R0`009`009`009;R0/R1 quadword
X`009ADDL2`009R10,R0
X`009ADWC`009R11,R1
X`009ASHQ`009#-SCALE_FACTOR_SHIFT,R0,R0`009;Divide by scale factor
X`009MOVL`009R0,M5
X; 15 min. load ave.
X`009EMUL`009M15,F3,#0,R10
X`009EMUL`009R2,F13,#0,R0`009`009`009;R0/R1 quadword
X`009ADDL2`009R10,R0
X`009ADWC`009R11,R1
X`009ASHQ`009#-SCALE_FACTOR_SHIFT,R0,R0`009;Divide by scale factor
X`009MOVL`009R0,M15
X
X`009CMPB`009R3,#255`009`009`009`009; NULL JOB
X`009BNEQ`00940$
X`009MOVB`009#31,R3`009`009`009`009; TREAT AS PRIORITY 0
X40$:`009SUBB3`009R3,#31,R2
X`009MOVZBL`009R2,R2
X`009ASHL`009#SCALE_FACTOR_SHIFT,R2,R2`009; Scaled priority
X; 1 min. priority ave.
X`009EMUL`009P1,F1,#0,R10
X`009EMUL`009R2,F11,#0,R0`009`009`009;R0/R1 quadword
X`009ADDL2`009R10,R0
X`009ADWC`009R11,R1
X`009ASHQ`009#-SCALE_FACTOR_SHIFT,R0,R0`009;Divide by scale factor
X`009MOVL`009R0,P1
X; 5 min. priority ave.
X`009EMUL`009P5,F2,#0,R10
X`009EMUL`009R2,F12,#0,R0`009`009`009;R0/R1 quadword
X`009ADDL2`009R10,R0
X`009ADWC`009R11,R1
X`009ASHQ`009#-SCALE_FACTOR_SHIFT,R0,R0`009;Divide by scale factor
X`009MOVL`009R0,P5
X; 15 min. priority ave.
X`009EMUL`009P15,F3,#0,R10
X`009EMUL`009R2,F13,#0,R0`009`009`009;R0/R1 quadword
X`009ADDL2`009R10,R0
X`009ADWC`009R11,R1
X`009ASHQ`009#-SCALE_FACTOR_SHIFT,R0,R0`009;Divide by scale factor
X`009MOVL`009R0,P15
X
X;
X;   Update the disk queue length information
X;
X`009CLRL`009R2`009`009`009`009; R2 = Sum of queue lengths
X`009CLRQ`009R10`009`009`009`009; Indicate start of I/O d.b.
X50$:`009JSB`009G`094IOC$SCAN_IODB`009`009`009; Get next DDB and UCB into R10
V, R11
X`009BLBC`009R0,80$`009`009`009`009;  no more, done
X`009CMPB`009#DC$_DISK,UCB$B_DEVCLASS(R10)`009; Is this controller a disk?
X`009BEQL`00960$
X`009CLRL`009R10`009`009`009`009; Go for next controller
X`009BRB`00950$
X60$:`009BBC`009#DEV$V_MNT,UCB$L_DEVCHAR(R10),50$ ; Skip if not mounted
X`009BITL`009#<DEV$M_CDP+DEV$M_SSM>,UCB$L_DEVCHAR2(R10) ; class driver or sha
Vdow set member?
X`009BNEQ`00950$`009`009`009`009;`009      if so, skip
X.If`009DF,EVAX
X`009MOVL`009UCB$L_QLEN(R10),R0
X.Iff
X`009CVTWL`009UCB$W_QLEN(R10),R0`009`009; Get queue length
X.Endc
X`009BGEQ`00970$
X`009CLRL`009R0`009`009`009`009; negative queu length is a temporary conditio
Vn
X70$:`009CMPL`009R0,R2
X`009BLEQ`00950$
X`009MOVL`009R0,R2
X`009BRB`00950$
X80$:
X
X; 1 min. queue ave.
X`009ASHL`009#SCALE_FACTOR_SHIFT,R2,R2`009;Scaled queue length
X`009EMUL`009Q1,F1,#0,R10
X`009EMUL`009R2,F11,#0,R0`009`009`009;R0/R1 quadword
X`009ADDL2`009R10,R0
X`009ADWC`009R11,R1
X`009ASHQ`009#-SCALE_FACTOR_SHIFT,R0,R0`009;Divide by scale factor
X`009MOVL`009R0,Q1
X; 5 min. queue ave
X`009EMUL`009Q5,F2,#0,R10
X`009EMUL`009R2,F12,#0,R0`009`009`009;R0/R1 quadword
X`009ADDL2`009R10,R0
X`009ADWC`009R11,R1
X`009ASHQ`009#-SCALE_FACTOR_SHIFT,R0,R0`009;Divide by scale factor
X`009MOVL`009R0,Q5
X; 15 min. queue ave.
X`009EMUL`009Q15,F3,#0,R10
X`009EMUL`009R2,F13,#0,R0`009`009`009;R0/R1 quadword
X`009ADDL2`009R10,R0
X`009ADWC`009R11,R1
X`009ASHQ`009#-SCALE_FACTOR_SHIFT,R0,R0`009;Divide by scale factor
X`009MOVL`009R0,Q15
X
X`009POPR`009#`094M<R10,R11>`009`009`009; restore registers
X`009RSB`009`009`009`009`009;Return to clock dispatcher
X
X
X
X`009.SBTTL`009END OF DRIVER
X;+ ---
X;
X; END OF DRIVER
X;
X;- ---
XLAV_END:`009`009`009`009`009;LET DPTAB KNOW THE DRIVER SIZE
X;
X`009.END
$ CALL UNPACK INETDRIVER.MAR;1 388543032
$ create/nolog 'f'
XCLUSTER=LAVDRIVER,,,-
X`009LAVDRIVER.OBJ,-
X`009ALPHA$LIBRARY:STARLET/INCLUDE:(-
X`009`009SYS$DOINIT,-
X`009`009SYS$DRIVER_INIT)
XPSECT_ATTR=_AMAC$CODE,PIC,USR,CON,REL,GBL,NOSHR,EXE,RD,NOWRT,NOVEC
XPSECT_ATTR=_AMAC$LINKAGE,PIC,USR,CON,REL,GBL,NOSHR,NOEXE,RD,WRT,NOVEC
XPSECT_ATTR=$CODE$,PIC,USR,CON,REL,GBL,NOSHR,EXE,RD,NOWRT,NOVEC
XPSECT_ATTR=$LINK$,PIC,USR,CON,REL,GBL,NOSHR,NOEXE,RD,WRT,NOVEC
XPSECT_ATTR=$PLIT$,PIC,USR,CON,REL,GBL,NOSHR,NOEXE,RD,WRT,NOVEC
XPSECT_ATTR=$OWN$,PIC,USR,CON,REL,GBL,NOSHR,NOEXE,RD,WRT,NOVEC
XPSECT_ATTR=$GLOBAL$,PIC,USR,CON,REL,GBL,NOSHR,NOEXE,RD,WRT,NOVEC
XPSECT_ATTR=EXEC$INIT_CODE,NOSHR
XPSECT_ATTR=EXEC$INIT_LINKAGE,PIC,USR,CON,REL,GBL,NOSHR,EXE,RD,WRT,NOVEC
XPSECT_ATTR=$$$115_LINKAGE,PIC,USR,CON,REL,GBL,NOSHR,NOEXE,RD,WRT,NOVEC
XCOLLECT=NONPAGED_READONLY_PSECTS/ATTRIBUTES=RESIDENT,-
X`009_AMAC$CODE,-
X`009EXEC$NONPAGED_CODE,-
X`009$$$115_DRIVER,-
X`009$CODE$
XCOLLECT=NONPAGED_READWRITE_PSECTS/ATTRIBUTES=RESIDENT,-
X`009_AMAC$LINKAGE,-
X`009EXEC$NONPAGED_DATA,-
X`009EXEC$NONPAGED_LINKAGE,-
X`009$$$105_PROLOGUE,-
X`009$$$110_DATA,-
X`009$$$115_LINKAGE,-
X`009$PLIT$,-
X`009$GLOBAL$,-
X`009$OWN$,-
X`009$LINK$
XCOLLECT=INITIALIZATION_PSECTS/ATTRIBUTES=INITIALIZATION_CODE,-
X`009EXEC$INIT_LINKAGE,-
X`009EXEC$INIT_CODE,-
X`009EXEC$INIT_000,-
X`009EXEC$INIT_001,-
X`009EXEC$INIT_002,-
X`009EXEC$INIT_SSTBL_000,-
X`009EXEC$INIT_SSTBL_001,-
X`009EXEC$INIT_SSTBL_002
$ CALL UNPACK INETDRIVER.OPT;2 1430013023
$ create/nolog 'f'
X$ VM = 'F$VER(0)
X$!
X$!
X$  type sys$input
X
XThis procedure will install WHAT on your system disk, Install the
XWHAT.CLD in SYS$COMMON:`091SYSLIB`093DCLTABLES.EXE and Install WHAT.HLP in
XSYS$COMMON:`091SYSHLP`093HELPLIB.
X
XYou need to have Built the images by running BUILD_WHAT.COM
Xbefore you can run this procedure.
X
X$ inquire ans "Do you wish to do procede? `091NO`093 "
X$ ans = f$edit("''ans'","trim")
X$ if ans.eqs."" then ans = "N"
X$ if .not.ans then write sys$Output "What NOT installed"
X$ if .not.ans then exit
X$!
X$ write sys$output "Installing WHAT"
X$!
X$ set proc/priv=all
X$ create/dir/own=`0911,4`093/log/prot=(s:rewd,g:rewd,o:rewd,w:e) -
X   sys$sysdevice:`091net_what`093
X$ define/system/exec what_dir sys$sysdevice:`091net_what`093
X$!
X$ copy *.exe what_dir:/prot=w:re
X$ copy *.com what_dir:/prot=w:Re
X$ copy *.cld what_dir:/prot=w:re
X$ copy *.hlp what_dir:/prot=w:Re
X$!
X$ ver = f$getsyi("version")
X$ lenv = f$length(ver)
X$ V5 = "FALSE"
X$ if f$locate("5.",ver).lt.lenv then V5 = "TRUE"
X$ create/dir /prot=w:re/log sys$sysdevice:`091net_what.source`093
X$ create/dir /prot=w:re/log sys$sysdevice:`091net_what.v5`093
X$ if v5 then write sys$output "This is a V5 System, Installing V5 version"
X$ if v5 then copy `091.v5`093*.exe/log what_dir:/prot=w:re
X$ write sys$output "installing sources and objects"
X$ copy `091.source`093*.* sys$sysdevice:`091net_what.source`093/prot=w:Re
X$ set def what_dir:
X$ write sys$output "installing CLD"
X$ set command what.cld
X$ set command/tables=sys$common:`091syslib`093dcltables -
X             /output=sys$common:`091syslib`093dcltables what.cld
X$ install == "$install/command"
X$ install replace sys$share:dcltables
X$!
X$ write sys$output "Installing HELP..."
X$ set noon
X$ set ver
X$ library/help sys$help:helplib  what.hlp
X$ VM = 'F$VER(0)
X$ type sys$input
X
X        Please remember to add the following lines to your
X        sys$manager:systartup.com file:
X
X        $ define/sys/exec what_dir sys$sysdevice:`091net_what`093
X        $ @what_dir:start_what
X
X        You may want to customize the file WHAT_DIR:WHATLOG.COM
X
X
X        Installation complete.. Starting WHAT
X
X$!
X$@what_dir:start_what
$ CALL UNPACK INSTALL.COM;1 3587268
$ create/nolog 'f'
X;    Oops. The Load Average driver I posted a few weeks ago had a
X;fatal bug. Fortunately, I fell on my own sword before anyone else
X;reported this to me. Here is a fixed version, which includes the
X;conditionals to run on VMS V4. Add a "VMS_V5=1" line at the top for
X;VMS V5.
X;`032
X;                        Ken
X;`032
X;`032
XVMS_V5 = 1
X    .TITLE    LAVDRIVER    VAX/VMS Load Average Pseudo Device
X    .IDENT    /Version 4.00/
X    .SBTTL    DOCUMENTATION
X;     VMS_V5 = 1
X;---------------S-R-I-International-Artificial-Intelligence-Center----------
V-
X;
X;
X; MODULE NAME:
X;
+-+-+-+-+-+-+-+-  END  OF PART 5 +-+-+-+-+-+-+-+-

