
                               					20-May-1983 10:17:32	VAX-11 FORTRAN V3.2-37              Page   1
								10-May-1983 10:13:04	CAD$VOLSET:[GARY.STATS.SOURCE]STATCPU.FOR;30

0001    !
0002    !			  COPYRIGHT (c) 1982 BY
0003    !	      MOSTEK CORPORATION, CARROLLTON TX
0004    !
0005    ! This software is furnished under a license and may be used and  copied
0006    ! only  in  accordance  with  the  terms  of  such  license and with the
0007    ! inclusion of the above copyright notice.  This software or  any  other
0008    ! copies  thereof may not be provided or otherwise made available to any
0009    ! other person.  No title to and ownership of  the  software  is  hereby
0010    ! transferred.
0011    !
0012    ! The information in this software is subject to change  without  notice
0013    ! and  should  not  be  construed  as  a commitment by MOSTEK
0014    ! CORPORATION.
0015    !
0016    ! MOSTEK assumes no responsibility for the use or  reliability  of  its
0017    ! software on equipment which is not supplied by MOSTEK.
0018    !
0019     
0020    !++
0021    ! FACILITY:
0022    !   MOSTEK CORPORATION
0023    !
0024    ! ABSTRACT:
0025    !   STATCPU gathers the percentage of time that the cpu spends in the 
0026    !   various states. It also gathers the number of batch, interactive
0027    !   and network jobs in the system.
0028    !
0029    ! ENVIRONMENT:
0030    !   VAX11 VMS   
0031    !
0032    ! AUTHOR: Gary Smith, CREATION DATE: 6/24/82
0033    !
0034    ! MODIFIED BY:
0035    !
0036    !--
0037    !
0038    ! TABLE OF CONTENTS:
0039    !
0040    !
0041    ! INCLUDE FILES:
0042    !   mousesubs.for
0043    !
0044    ! MACROS:
0045    !   none
0046    !
0047    ! EQUATED SYMBOLS:
0048    !   see mousesubs.for
0049    !
0050    ! EXTERNAL REFERENCES:
0051    !   PMS$GL_KERNEL,SYS$GW_BJOBCNT,SYS$GW_IJOBCNT,SYS$GW_NJOBCNT
0052     
0053    !++
0054    ! FUNCTIONAL DESCRIPTION:
0055    !   Using PMS$GL_KERNEL as a base, STATCPU gets the total time for each
0056    !   of the modes of the cpu. This is used to calculate the percent spent
0057    !   in each mode since the last inspection by STATCPU

                               					20-May-1983 10:17:32	VAX-11 FORTRAN V3.2-37              Page   2
								10-May-1983 10:13:04	CAD$VOLSET:[GARY.STATS.SOURCE]STATCPU.FOR;30

0058    !
0059    !
0060    ! FORMAL PARAMETERS:
0061    !   none
0062    !
0063    !
0064    ! IMPLICIT INPUTS:
0065    !   rec_cpu_modes
0066    !
0067    !
0068    ! IMPLICIT OUTPUTS:
0069    !   rec_cpu_modes
0070    !
0071    !
0072    ! ROUTINE VALUE and
0073    ! COMPLETION CODES:
0074    !   none
0075    !
0076    !
0077    ! SIDE EFFECTS:
0078    !   none to date
0079    !
0080    !
0081    !--
0082            SUBROUTINE STATCPU              !! CPU activity
0083     
0084            external PMS$GL_KERNEL          !! Tot. times in states
0085            external SYS$GW_BJOBCNT         !! # of Batch Jobs
0086            external SYS$GW_IJOBCNT         !! # of Interactive jobs
0087            external SYS$GW_NJOBCNT         !! # of DECnet jobs
0088            external SCH$GL_NULLPCB         !! addr of null pcb
0089            external PCB$L_PHD              !! offset to PHD
0090            external PHD$L_CPUTIM           !! offset to cpu time
0091     
0092            include 'mousesubs.for'
0295            include 'defrec.for'
0397     
0398            integer last_mode(cpu_size), phd
0399     
0400     
0401    !++
0402    ! gather up the numbers of the time spent in each mode
0403    !--
0404     
0405              do i = 1, num_modes
0406                 rec_cpu_modes(i) =  ML$L_PEEK(%LOC(PMS$GL_KERNEL)+4*(i-1))
0407              enddo
0408     
0409     
0410              phd = ML$L_PEEK( %LOC(SCH$GL_NULLPCB) +  %LOC(PCB$L_PHD) ) 
0411              rec_cpu_modes(idle) = ML$L_PEEK( ML$L_PEEK(%LOC(phd)) + 
0412         .                      %LOC(PHD$L_CPUTIM) )
0413     
0414    	  total_time = 0.0
0415     
0416    	  do i = 1, num_modes
0417    	    total_time = total_time + ( rec_cpu_modes(i) - 

STATCPU                        					20-May-1983 10:17:32	VAX-11 FORTRAN V3.2-37              Page   3
								10-May-1983 10:13:04	CAD$VOLSET:[GARY.STATS.SOURCE]STATCPU.FOR;30

0418         .                   last_mode(i) )
0419    	  enddo
0420     
0421    	  if ( total_time .le. 0.1 ) total_time = 1.0
0422     
0423    	  do i = 1, num_modes
0424    	    temp = rec_cpu_modes(i)
0425    	    rec_cpu_modes(i) = nint( 100*( ( temp - last_mode(i) ) / 
0426         .                    total_time ) )
0427    	    last_mode(i) = temp
0428    	  enddo
0429     
0430    !++
0431    ! peek at the batch and interactive counts
0432    !--
0433     
0434    	  rec_cpu_modes(bjobcnt) = 'ffff'x .and. 
0435         .                        ML$L_PEEK(%LOC(SYS$GW_BJOBCNT))
0436    	  rec_cpu_modes(ijobcnt) = 'ffff'x .and. 
0437         .                        ML$L_PEEK(%LOC(SYS$GW_IJOBCNT))
0438     
0439              return
0440              end




PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  334   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  2 $LOCAL                                  68   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG
  3 REC_COMMON                             348   PIC OVR REL GBL   SHR NOEXE   RD   WRT LONG

    Total Space Allocated                  750


ENTRY POINTS

    Address  Type  Name                                        References

  0-00000000       STATCPU                                        82     


VARIABLES

    Address  Type  Name                            Attributes  References

  2-00000028  I*4  I                                             405=      406(2)    416=      417(2)    423=      424     
							         425(2)    427     
  2-00000024  I*4  PHD                                           398       410=      411     
  3-00000108  I*4  REC_RESPONSE                    COMM EQUIV    298       355     
  2-00000030  R*4  TEMP                                          424=      425       427     
  2-0000002C  R*4  TOTAL_TIME                                    414=      417(2)=   421(2)=   425     


STATCPU                        					20-May-1983 10:17:32	VAX-11 FORTRAN V3.2-37              Page   4
								10-May-1983 10:13:04	CAD$VOLSET:[GARY.STATS.SOURCE]STATCPU.FOR;30

ARRAYS

    Address  Type  Name                            Attributes        Bytes  Dimensions       References

  2-00000000  I*4  LAST_MODE                                           36  (9)                 398       417       425     
											       427=    
  3-00000000  I*4  REC_CPU_MODES                   COMM EQUIV          36  (9)                 300       312       406=    
											       411=      417       424     
											       425=      434=      436=    
  3-00000024  I*4  REC_FCP                         COMM EQUIV          20  (5)                 306       319     
  3-00000120  I*4  REC_LOCK_MODES                  COMM EQUIV          28  (7)                 308       374     
  3-00000080  I*4  REC_MEM_MODES                   COMM EQUIV           8  (2)                 301       324     

  3-00000038  I*4  REC_MISC                        COMM EQUIV          72  (18)                303       321     
  3-0000010C  I*4  REC_NET_MODES                   COMM EQUIV          20  (5)                 307       364     
  3-00000088  I*4  REC_PGFLT                       COMM EQUIV          28  (7)                 305       328     
  3-0000013C  I*4  REC_POOL_MODES                  COMM EQUIV          32  (8)                 309       385     
  3-000000A4  I*4  REC_SCH_STATE                   COMM EQUIV          56  (14)                304       333     

  3-000000DC  I*4  REC_SWAP                        COMM EQUIV          36  (9)                 302       339     
  3-00000100  I*4  REC_TIME                        COMM EQUIV           8  (2)                 299       346     
  3-00000000  I*4  STATS_REC                       COMM EQUIV         348  (87)                296       310       312     
											       319       321       324     
											       328       333       339     
											       346       355       364     
											       374       385     


PARAMETER CONSTANTS

  Type  Name                                                   References

   I*2  ARRLOCPK                                                 239#    
   I*2  ARRTRAPK                                                 240#    
   CHAR ASCII_DELTA_TIME                                          97        98#    
   I*2  BIGHOLE                                                  273#    
   I*2  BJOBCNT                                                  129#      434     

   I*2  BUFIO                                                    150#    
   I*2  CEF                                                      196#    
   I*2  COLPG                                                    194#    
   I*2  COM                                                      205#    
   I*2  COMO                                                     206#    

   I*2  COMPAT                                                   127#    
   I*2  CPU_SIZE                                                 132#      289       300       319       321       324     
							         328       333       339       346       355       364     
							         374       385       398     
   I*2  CUR                                                      207#    
   I*2  DEPLOCPK                                                 241#    
   I*2  DEQ                                                      255#    

   I*2  DIRHIT                                                   159#    
   I*2  DIRIO                                                    149#    
   I*2  DIRMISS                                                  160#    
   I*2  DLCKFND                                                  256#    
   I*2  DLCKSRCH                                                 257#    

STATCPU                        					20-May-1983 10:17:32	VAX-11 FORTRAN V3.2-37              Page   5
								10-May-1983 10:13:04	CAD$VOLSET:[GARY.STATS.SOURCE]STATCPU.FOR;30


   I*2  DZROFLTS                                                 181#    
   I*2  ENQCVT                                                   258#    
   I*2  ENQNEW                                                   253#    
   I*2  ENQNOTQD                                                 259#    
   I*2  ENQWAIT                                                  254#    

   I*2  EXEC                                                     124#    
   I*2  EXTHIT                                                   161#    
   I*2  EXTMISS                                                  162#    
   I*2  FAULTS                                                   182#    
   I*2  FCP_CACHE                                                139#    

   I*2  FCP_CALLS                                                138#    
   I*2  FCP_CPU                                                  140#    
   I*2  FCP_READ                                                 141#    
   I*2  FCP_SIZE                                                 144#      289       306       321       324       328     
							         333       339       346       355       364       374     
							         385     
   I*2  FCP_WRITE                                                142#    

   I*2  FIDHIT                                                   163#    
   I*2  FIDMISS                                                  164#    
   I*2  FPG                                                      204#    
   I*2  FREECNT                                                  173#    
   I*2  GETDVI_EF                                                112#    

   I*2  HIB                                                      200#    
   I*2  HIBO                                                     201#    
   I*2  HISWPCNT                                                 219#    
   I*2  HIT                                                      156#    
   I*2  HOLECNT                                                  272#    

   I*2  HOLESUM                                                  276#    
   I*2  HOSWPCNT                                                 218#    
   I*2  IDLE                                                     128#      411     
   I*2  IJOBCNT                                                  130#      436     
   I*2  INT                                                      126#    

   I*2  IRPCNT                                                   271#    
   I*2  ISPAGCNT                                                 214#    
   I*2  ISWPCNT                                                  215#    
   I*2  KERNEL                                                   122#    
   I*2  KEY_SIZE                                                 118#    

   I*2  LEF                                                      198#    
   I*2  LEFO                                                     199#    
   I*2  LOCK_SIZE                                                264#      289       308       385     
   I*2  LOGNAM                                                   151#    
   I*2  LRPCNT                                                   277#    

   I*2  MBREADS                                                  152#    
   I*2  MBWRITES                                                 153#    
   I*2  MEM_SIZE                                                 176#      289       301       328       333       339     
							         346       355       364       374       385     
   I*2  MFYCNT                                                   174#    
   I*2  MISC_SIZE                                                168#      289       303       324       328       333     

STATCPU                        					20-May-1983 10:17:32	VAX-11 FORTRAN V3.2-37              Page   6
								10-May-1983 10:13:04	CAD$VOLSET:[GARY.STATS.SOURCE]STATCPU.FOR;30

							         339       346       355       364       374       385     

   I*2  MWAIT                                                    195#    
   I*2  NET_SIZE                                                 248#      289       307       374       385     
   I*2  NUM_MODES                                                133#      405       416       423     
   I*2  OPEN                                                     158#    
   I*2  OPENS                                                    157#    

   I*2  OSWPCNT                                                  217#    
   I*2  PFW                                                      197#    
   I*2  PGFLT_SIZE                                               189#      289       305       333       339       346     
							         355       364       374       385     
   I*2  POOL_SIZE                                                284#      289       309     
   I*2  PREADIO                                                  183#    

   I*2  PREADS                                                   185#    
   I*2  PROCCNT                                                  216#    
   I*2  PWRITES                                                  186#    
   I*2  PWRITIO                                                  184#    
   I*2  QUOHIT                                                   165#    

   I*2  QUOMISS                                                  166#    
   I*2  RCVBUFFL                                                 242#    
   I*2  RDFLTS                                                   187#    
   I*2  REC_SIZE                                                 289#      310     
   I*2  RES                                                      234#    

   I*2  RESPONSE_SIZE                                            233#      289       364       374       385     
   I*2  SCH_SIZE                                                 209#      289       304       339       346       355     
							         364       374       385     
   I*2  SMALLCNT                                                 275#    
   I*2  SMALLHOLE                                                274#    
   I*2  SPLIT                                                    155#    

   I*2  SRPCNT                                                   278#    
   CHAR STANDARD_NEST_FILE                                       104       105#    
   I*2  SUPER                                                    123#    
   I*2  SUSP                                                     202#    
   I*2  SUSPO                                                    203#    

   I*2  SWAP_SIZE                                                221#      289       302       346       355       364     
							         374       385     
   I*2  SWAP_SPARES                                              222#    
   I*2  TIME_SIZE                                                227#      289       299       355       364       374     
							         385     
   I*2  TRCNGLOS                                                 243#    
   I*2  TURN                                                     154#    

   I*2  USER                                                     125#    
   I*2  WAIT_EF                                                  111#    

STATCPU                        					20-May-1983 10:17:32	VAX-11 FORTRAN V3.2-37              Page   7
								10-May-1983 10:13:04	CAD$VOLSET:[GARY.STATS.SOURCE]STATCPU.FOR;30

FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name                                                   References

   I*4  ML$L_PEEK                                                406       410       411(2)    434       436     
        PCB$L_PHD                                                 89       410     
        PHD$L_CPUTIM                                              90       411     
        PMS$GL_KERNEL                                             84       406     
        SCH$GL_NULLPCB                                            88       410     

        SYS$GW_BJOBCNT                                            85       434     
        SYS$GW_IJOBCNT                                            86       436     
        SYS$GW_NJOBCNT                                            87     


  +----------------------------------------------+
  |           KEY TO REFERENCE FLAGS             |
  |   =   - Value Modified                       |
  |   #   - Defining Reference                   |
  |   A   - Actual Argument, possibly modified   |
  |   D   - Data Initialization                  |
  |  (n)  - Number of occurrences on line        |
  +----------------------------------------------+



COMMAND QUALIFIERS

  FORTRAN /DEBUG/OBJECT=OBJ:STATCPU/LIST=LIS:STATCPU/CONT=99/CROSS/NOOPT SRC:STATCPU

  /CHECK=(NOBOUNDS,OVERFLOW,NOUNDERFLOW)
  /DEBUG=(SYMBOLS,TRACEBACK)
  /STANDARD=(NOSYNTAX,NOSOURCE_FORM)
  /SHOW=(NOPREPROCESSOR,NOINCLUDE,MAP)
  /F77  /NOG_FLOATING  /I4  /NOOPTIMIZE  /WARNINGS  /NOD_LINES  /CROSS_REFERENCE  /NOMACHINE_CODE  /CONTINUATIONS=99


COMPILATION STATISTICS

  Run Time:           2.83 seconds
  Elapsed Time:       7.59 seconds
  Page Faults:        483
  Dynamic Memory:     847 pages
