From:	SMTP%"turion@research.ptt.nl" 23-MAR-1994 08:44:21.74
To:	EVERHART
CC:	
Subj:	part 15 status tool

X-Newsgroups: comp.os.vms
From: turion_s@dnlts0research.ptt.nl. (Paul Turion)
Subject: part 15 status tool
Message-Id: <1994Mar21.145036.2260@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:50:36 GMT
Lines: 375
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 15 -+-+-+-+-+-+-+-+
X                movc5   term_descr, term+1, #32, #16, term ; Move the string
V back one
X;
X;
X;
Xget_other_info: movtc   #8, account, #32, table, #8, account    ; Clean out
V the account string
X                cmpb    #32, account                    ; Do we have a crap
V account
X                bneq    calc_state
X                movc5   #0,#0,#32,#8,account            ; Clean out crap acc
Vounts
X;
Xcalc_state:     mull3   #3, state, r0                   ; Get the offset int
Vothe state array
X                movc3   #3, -3(r8)`091r0`093, char_state      ; Move the cha
Vracter representation of the state
X;
X                movc3   #5, null_time, char_time        ; Default value for
V character time
X                movc3   #4, null_cpu, char_cpu          ; Default value for
V character cpu
X;
X                cmpl    state, #SCH$C_SUSPO
X                beql    we_are_swap
X                cmpl    state, #SCH$C_LEFO
X                beql    we_are_swap
X                cmpl    state, #SCH$C_COMO
X                beql    we_are_swap
X                cmpl    state, #SCH$C_HIBO
X                bneq    not_swap
X;
Xwe_are_swap:    movc5   #9, swapped_str, #32, #17, name_only
X                brw     have_a_term
X;
Xnot_swap:       $getjpiw_s -
X                        pidadr = pid, -         ; Get more info on current p
Vrocess
X                        itmlst = jpi_p1         ; Here is the info we want
X                blbc    r0, proc_suspend        ; If it failed, process is s
Vuspended
X;
X                $asctim_s -                     ; Convert the login time to
V astring
X                        timlen = char_time_descr, - ; How long the string is
X                        timbuf = char_time_descr, - ; Where the buffer is
X                        timadr = login_time, -      ; The time to be convert
Ved
X                        cvtflg = #1             ; We just want the time
X                pushal  name_descr              ; Where to put the length
X                pushal  name_descr              ; Where to put the image
X                pushal  image_descr             ; The image we have
X                calls   #3, g`094what_parseimage   ; Parse out the image str
Ving
X                brb     cont_swap               ; Finish the swap
X;
Xproc_suspend:   movc5   #9, suspnd_str, #32, #17, name_only
X;
Xcont_swap:      divl3   #100, cpu_time, fcpu
X                pushal  char_cpu_descr
X                pushal  fcpu
X                calls   #2, g`094ots$cvt_l_ti      ; Convert the cpu time to
V a string
X;
Xhave_a_term:    tstb    term                    ; Did we get a terminal?
X                bneq    format_strings          ; If owner is 0 then just fo
Vrmat the strings
X;
X                tstl    owner                   ; If we are not a subprocess
X                beql    get_term                ; Get the terminal string wi
Vth the current mode
X;
X                movl    #SUBPROC, mode          ; We are a subprocess otherw
Vise
X;
Xget_term:       mull3   #6, mode, r0            ; Compute offset of into cha
Vracter array
X                movc5   #6, (r9)`091r0`093, #32, #16, term ; - that contains
V the mode string for bad terminals
X;
X;
X;
Xformat_strings: pushal  fao_list                ; Push our address of our ar
Vguments
X                pushal  outstr_descr            ; Push the descriptor of out
V output string
X                pushal  l_ostr                  ; Push where the output leng
Vth should be put
X                pushl   (r6)`091r11`093               ; Push the address of
V the control string we want
X                calls   #4, g`094sys$faol          ; Call the Formatted Asci
Vi Output service
X                movc5   l_ostr, outstr, #32, #80, (r7) ; Move the formatted
V string
X                movl    r3, r7                  ; Save new address in print
V buffer
X;
X                brw     loop                    ; Go back and get next proce
Vss
X;
X;
X;
Xend_loop:       moval   buffer, r1              ; Move the address of our bu
Vffer for computation
X                movl    chan_buf_adr, r10       ; Move address of channel or
V buffer into r10, easier to work with
X                blbs    chan_buf, use_channel   ; Do we want to use a channe
Vl?
X                subl3   r1, r7, (r10)           ; Compute the length of the
V buffer
X                movc5   (r10), buffer, #32, (r10), @4(r10) ; Move all the in
Vformation to the user specified buffer
X                ret
X;
Xuse_channel:    subl3   r1, r7, r6              ; Compute the length of the
V buffer
X                $qiow_s -
X                        chan = (r10), -         ; What channel to write to
X                        func = #IO$_WRITEVBLK,- ; Write out the line
X                        iosb = iosblk, -        ; Status of operation
X                        p1 = buffer, -          ; Where to write from
X                        p2 = r6                 ; Length of bytes to put out
X                movzwl  iosblk, r0              ; Return the status conditio
Vn
X                ret                             ; End of What_look
X;
X                .end
$ CALL UNPACK WHAT_LOOK.MAR;1 1997775732
$ create/nolog 'f'
X.title          WHAT_SHAR Sharable messages
X
X.facility       WHAT,1
X.severity       FATAL
XBADLNM          <Error translating logical name !AS>/fao=1
X.severity       ERROR
XTALKFAIL        <Unable to talk to node !AS>/fao=1
X.end
$ CALL UNPACK WHAT_MSG.MSG;1 52458222
$ create/nolog 'f'
X                .title  WHAT_PARSEIMAGE
X;
X                .psect  what_parseimage_data, noexe, pic, noshr, lcl, wrt, r
Vd, rel, con
X;
XFSCN$_NAME = 6                                  ; Code for the name
XFSCN$_VERSION = 8                               ; Code for the version
Xitemlist:                                       ; Item list for SYS$FILESCAN
X;
Xname_len:       .word   0                       ; How long the name is
Xnamecode:       .word   FSCN$_NAME              ; We want the name
Xname_adr:       .long   1                       ; Where the name is
X;
Xvers_len:       .word   0                       ; How long the version is
Xverscode:       .word   FSCN$_VERSION           ; We want the version
Xvers_adr:       .long   1                       ; Where the version is
X;
Xend_list:       .long   0                       ; End of our list
X;
X;
X;
X;***************************************************************************
V****
X;* What_parseimage *
X;*      This procedure is intended to parse out the the name of the image *
X;* from imag field returned by SYS$GETJPIW.  Known images have $ in front. *
X;* For those system managers who like to catch sneaky people passing off the
V *
X;* name programs $.EXE, the real $ which stands for DCL will be pulled back
V a *
X;* character, whereas $.EXE will show up one space over. *
X;***************************************************************************
V****
X;
X                .psect  what_parseimage_code, con, exe, lcl, shr, nowrt, pic
V,rel
X;
X                .entry  what_parseimage, `094m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r
V11>
X;
X                movl    4(ap), r9               ; Descriptor of string to pa
Vrse
X                movl    8(ap), r10              ; Descriptor of string to re
Vturn
X                movl    12(ap), r11             ; Length of string returned
X;
X                movl    4(r10), r8              ; Get address of string to r
Vet
X                movc5   #0,#0,#32,(r10),(r8)    ; Blank out return string
X;
X                $filescan_s -
X                        srcstr = (r9), -        ; Give the address of our st
Vring
X                        valuelst = itemlist     ; Item list of what we want
X;
X                blbc    r0, trim_name           ; Error, just put a "$"
X;
X                tstw    name_len                ; Was there anything at all
X                beql    known_imag              ; No image, just at DCL prom
Vpt
X;
X                tstw    vers_len                ; Have we found a version
X                beql    known_imag              ; If not, we know the image
X;
X                movb    #`094a/ /, (r8)+           ; Move the name to the st
Vring
X                brb     move_name               ; Now move the name
X;
Xknown_imag:     movb    #`094a/$/, (r8)+           ; We know the image
X;
Xmove_name:      movl    name_adr, r7
X                movc3   name_len, (r7), (r8)    ; Move the name to the strin
Vg
X;
Xtrim_name:      pushl   r11                     ; Address of return length
X                pushl   r10                     ; Address of string to trim
X                pushl   r10                     ; Address to put trimmed str
Ving
X                calls   #3, g`094str$trim          ; Trim the string
X;
Xend:            movl    #1, r0
X                ret                             ; End of What_parseimage
X;
X                .end
$ CALL UNPACK WHAT_PARSEIMAGE.MAR;1 320680155
$ create/nolog 'f'
X                .title  WHAT_RETNODES
X;
X                $ssdef
X;
X                .psect  what_retnodes_data, noexe, pic, noshr, lcl, wrt, rd,
V rel, con
X;
Xentity_desc:    .ascid  /NODE/
X;
Xret_string:     .byte   32`091255`093
X;
Xretdesc:        .long   255
X                .address ret_string
X;
Xretlength:      .word   0
X;
X;
X;
X;***************************************************************************
V****
X;* What_retnodes *
X;*      This procedure is intended to get all the nodes from the qualifier *
X;* 'NODE'.  It assembles them into the record NODES. *
X;* *
X;* Arguments:   Nodes - reference, dae_nodes_descr *
X;***************************************************************************
V****
X;
X                .psect  what_retnodes_code, con, exe, lcl, shr, nowrt, pic,
V rel
X;
X                .entry  what_retnodes, `094m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11
V>
X;
X                movl    4(ap), r11              ; Address of total record
X                addl3   #1, r11, r10            ; Increment to the first rec
Vord
X                clrl    r9                      ; Counter of nodes returned
X;
Xloop:           pushaw  retlength
X                pushal  retdesc
X                pushal  entity_desc
X                calls   #3, g`094cli$get_value     ; Get the value on the li
Vne
X                movl    r0, r8                  ; Save return value
X;
X                incl    r9                      ; Increment number returned
X                movb    retlength, (r10)+       ; Save its length
X                movc5   retlength, ret_string, #32, #6, (r10) ; Save the str
Ving
X                movl    r3, r10                 ; Save new address in record
X;
X                cmpl    #SS$_NORMAL, r8         ; Have we returned the last
V one?
X                bneq    loop                    ; Keep going
X;
X                movb    r9, (r11)               ; Save the number returned
X                movl    #1, r0                  ; Return success
X                ret                             ; End of What_retnodes
X;
X                .end
$ CALL UNPACK WHAT_RETNODES.MAR;1 1881959030
$ create/nolog 'f'
X                .title  WHAT_STATUS
X;
X                .psect  what_status_data, noexe, pic, noshr, lcl, wrt, rd, r
Vel, con
X;
X                $syidef                         ; Get $GETSYI definitions
X;
Xijoblim:        .address sys$gw_ijoblim
Xijobcnt:        .address sys$gw_ijobcnt
Xbjobcnt:        .address sys$gw_bjobcnt
Xnjobcnt:        .address sys$gw_njobcnt
Xproccnt:        .address sch$gw_proccnt
Xfreecnt:        .address sch$gl_freecnt
X;
XMAX_NODE_LEN = 6                                ; Length of a node name
XMAX_VER_LEN = 8                                 ; Length of the op sys versi
Von
XMAX_CPU_LEN = 4                                 ; Lenght of the cpu type
X;
Xdevice:         .ascid  /LAV0:/                 ; Device we talk to for load
V info
Xassigned:       .byte   0                       ; Whether we have assign a c
Vhannel yet
Xload_chan:      .long   0                       ; The channel to the load av
Verage device
Xiosblk:         .quad   0                       ; IO status block
X;
Xstat_buf:
Xnode:           .blkb   MAX_NODE_LEN            ; Maximum node length
Xversion:        .blkb   MAX_VER_LEN             ; Suggested amount to reserv
Vefor version, $GETSYI
Xcpu_type:       .blkb   MAX_CPU_LEN             ; Suggested amount to reserv
Vefor type of cpu, $GETSYI
XCHAR_PART_LEN = . - node                        ; How long the character fie
Vlds total
Xboot_time:      .quad   0                       ; Boot time of processor, $G
VETSYI
Xjob_lim:        .word   0                       ; Maximum number of users
Xint_cnt:        .word   0                       ; Number of interactive proc
Vesses
Xbat_cnt:        .word   0                       ; Number of batch processes
Xnet_cnt:        .word   0                       ; Number of network processe
Vs
Xtot_cnt:        .word   0                       ; Total number of processes
Xload_avg:       .float  -1                      ; Load average, 1 5 15 minut
Veintervals
X                .float  -1
X                .float  -1
Xfreepages:      .long   0                       ; Number of memory pages fre
Ve
XSTAT_LEN = .-stat_buf                           ; How long is our status buf
Vfer
X;
Xstat_descr:     .long   STAT_LEN                ; Length of the information
X                .address stat_buf               ; Where information is
X;
Xtemp_node:      .blkb   15                      ; Temporary place to hold th
Venode
Xl_node:         .long   0                       ; Actual length of the node
Xl_ver:          .long   0                       ; Actual length of the op sy
Vsversion
Xl_cpu:          .long   0                       ; Actual length of the cpu t
Vype
Xretlength:      .long   0                       ; Dummy return length
X;
Xsyi_list:       .word   15                      ; Suggested length of the bu
Vffer
X                .word   SYI$_NODENAME           ; We want the node name
X                .address temp_node              ; Temporary place to put the
V node
X                .address l_node                 ; How long the node is
X;
X                .word   8                       ; Boot time is a quad word,
V 8bytes
X                .word   SYI$_BOOTTIME           ; We want the boot time
X                .address boot_time              ; Where to put the boot time
+-+-+-+-+-+-+-+-  END  OF PART 15 +-+-+-+-+-+-+-+-

