<< LINES .001/.009 ARE RESERVED FOR SYSTEMS INTEGRATION>>               00005000
$CONTROL USLINIT,MAP,LIST,CODE                                          00010000
<< MEASSEG - MODULE 96 >>                                               00015000
<< HP32002C MPE SOURCE C.00.00 >>                                       00020000
$COPYRIGHT     "(C) COPYRIGHT HEWLETT-PACKARD CO. 1980. ",            & 00025000
$     "THIS PROGRAM MAY BE USED WITH ONE COMPUTER SYSTEM AT A ",      & 00030000
$     "TIME AND SHALL NOT OTHERWISE BE RECORDED, TRANSMITTED OR ",    & 00035000
$     "STORED IN A RETRIEVAL SYSTEM.  COPYING OR OTHER REPRODUCTION ",& 00040000
$     "OF THIS PROGRAM EXCEPT FOR ARCHIVAL PURPOSES IS PROHIBITED ",  & 00045000
$     "WITHOUT THE PRIOR WRITTEN CONSENT OF HEWLETT-PACKARD COMPANY."   00050000
$CONTROL PRIVILEGED,SEGMENT=MEASSEG,MAIN=MEASSEG                        00055000
$TITLE "  MPE IV MEASUREMENT INTERFACE "                                00060000
$PAGE "           MPE IV MEASUREMENT SUPPORT "                          00065000
<<*************************************************************<<04114>>00070000
*                                                             *<<04114>>00075000
*                                                             *<<04114>>00080000
*                 MPE IV Measurement Support                  *<<04114>>00085000
*                                                             *<<04114>>00090000
*                                                             *<<04114>>00095000
*************************************************************>><<04114>>00100000
<<                                                                      00105000
                                                                        00110000
I. Introduction                                                         00115000
                                                                        00120000
Regarding supported performance measurement and analysis tools,         00125000
the ideal direction from investment, support, and reliability           00130000
standpoints is towards having all such tools designed in an oper-       00135000
ating system invariant manner and executing nonprivileged.  This        00140000
would enable us to maintain consistency in the user interface,          00145000
cut support and overlapping development costs, and improve relia-       00150000
bility by reducing the amount of privileged code running on the         00155000
systems.  An attainable direction for 3000 family performance           00160000
tools is to make current tools and future designs operating             00165000
system version invariant, and to provide in MPE the mechanisms,         00170000
structures and interfacing so that code relying on MPE internal         00175000
structures and behavior is within the MPE domain.  Extracting MPE       00180000
structure and strategy dependent code will facilitate the               00185000
development of the next major operating system versions.                00190000
                                                                        00195000
Performance measurement and analysis tools require cooperation          00200000
from the system under test. The tools need not however be               00205000
dependent on the system's particular characteristics.  The system       00210000
can instead provide the basic mechanisms to acquire the data and        00215000
an interface to control the mechanisms and access the data so           00220000
that the specific characteristics are transparent.                      00225000
                                                                        00230000
Limiting performance tool control/access of hardware and OS             00235000
mechanisms to that provided by a well-defined interface improves        00240000
the extensibility and maintainability of both the operating             00245000
system and the measurement tools.  With respect to the                  00250000
operating system : (i). the areas and extent of impact of               00255000
proposed operating system changes can be more easily and                00260000
accurately estimated; and (ii). the implementation of modifi-           00265000
cations is simplified since changes affecting the mechanisms will       00270000
need to be reflected only in MPE and not in each performance            00275000
tool.  With respect to performance tools: (i). such tools will be       00280000
assured of the continuing external appearence of the fundamental        00285000
mechanisms; and (ii). maintenance of the mechanisms as well as          00290000
the interface will be the joint responsibility of MPE and the           00295000
performance group.                                                      00300000
                                                                        00305000
MPE IV measurement support aims at the above achievable                 00310000
direction.  Approaching this direction requires that :                  00315000
                                                                        00320000
  (i). the operating system provide the basic mechanisms and            00325000
       necessary support structures, control procedures, and            00330000
       access procedures required to support current and planned        00335000
       tools; and                                                       00340000
                                                                        00345000
 (ii). measurement tools limit their access of MPE internal data        00350000
       structures and mechanism controls to that provided by the        00355000
       interface.  If access is required to other information or        00360000
       additional support routines are required, these will be          00365000
       incorporated into the operating system, and access proce-        00370000
       dures or procedure extensions will be added to the               00375000
       measurement subsystem interface.                                 00380000
                                                                        00385000
This document provides a statement of objectives and the specifi-       00390000
cation of MPEIV measurement support.  A new MPE mechanism, the          00395000
MPE statistics gathering facility, is introduced, and the               00400000
associted interface data structures and access and control proce-       00405000
dures are defined.                                                      00410000
                                                                        00415000
$PAGE                                                                   00420000
II. Objectives and Requirements                                         00425000
                                                                        00430000
                                                                        00435000
The objectives and requirements of MPEIV measurement support are:       00440000
                                                                        00445000
   A. Service                                                           00450000
                                                                        00455000
      The mechanisms, their support structures, and the access          00460000
      and control procedures of the interface are to provide the        00465000
      information and the access to the information required by         00470000
      existent and planned performance measurement and analysis         00475000
      tools.  In particular, the kernel statistics required for         00480000
      the RTM, DSA and Monitor tools as well as the accounting          00485000
      extensions which will be supported by the released MPE IV         00490000
      operating system are to be supported by the interface.            00495000
                                                                        00500000
   B. Transparency                                                      00505000
                                                                        00510000
      Eliminate dependencies of measurement tools on MPE internal       00515000
      data structures and strategies by restricting access to           00520000
      that provided by the standard interface.                          00525000
                                                                        00530000
   C. Extensibility                                                     00535000
                                                                        00540000
      The basic mechanisms, the interface data structures, and          00545000
      the interface control and access procedures are to be             00550000
      sufficiently flexible so that future requirements for             00555000
      measurement support can be easily satisfied by extending          00560000
      the original specification.                                       00565000
                                                                        00570000
   D. Low Overhead                                                      00575000
                                                                        00580000
      The system support code implementing the basic mechanisms         00585000
      should minimally degrade performance. Performance of the          00590000
      access and control procedures, though a definite concern,         00595000
      is a secondary concern.                                           00600000
                                                                        00605000
   E. Maintenance                                                       00610000
                                                                        00615000
      For ease of maintenance by both MPE and the performance           00620000
      groups, control and access procedures relating to MPE's           00625000
      basic measurement mechanisms, as well as privileged code          00630000
      dependent on MPE structures and strategies, will be grad-         00635000
      ually collected into isolated segments and maintained             00640000
      jointly by MPE and the performance groups.                        00645000
$PAGE                                                                   00650000
III. MPE IV's Statistics Gathering Mechanism                            00655000
                                                                        00660000
Classes of statistics are useful in characterizing aspects of           00665000
system performance.  Due to their nature, these statistics can          00670000
only be generated with the operating system's cooperation.  A           00675000
standard, extensible scheme for generating and accessing such           00680000
statistics is required.                                                 00685000
                                                                        00690000
MPE IV has a mechanism which, when enabled, updates supported           00695000
classes of statistics into an extra data segments.  Intrinsics to       00700000
control the mechanism and to access the information are also            00705000
provided.  The currently supported statistics classes,                  00710000
subclasses, and items are given in Appendix 1.  The assignments         00715000
will be maintained along with the master tables.                        00720000
                                                                        00725000
The statistics gathering mechanism is enabled/disabled via the          00730000
control procedures STARTSTATISTICS and STOPSTATISTICS defined           00735000
below.  These procedures manipulate a primary sysglob cell called       00740000
GCLASSENABLEDMASK, and some counters in a resident measurement          00745000
control table.  GCLASSENABLEDMASK is a bitmask of the statistics        00750000
classes that are currently enabled.  The counters keep track for        00755000
each class of the number of processes which currently desire that       00760000
statistics in that class be gathered.                                   00765000
                                                                        00770000
When GCLASSENABLEDMASK is non-zero, one or more processes is re-        00775000
questing that one or more statistics classes be updated by MPE.         00780000
An extra data segment has been acquired, formatted, locked and          00785000
frozen for this purpose. In some cases seperate data segments           00790000
will be maintained for different classes of statistics. Specific        00795000
name assignments for currently defined classes of statistics are        00800000
as follows:                                                             00805000
                                                                        00810000
           CLASS NO.     XDS NAME          TYPE OF DATA                 00815000
                                                                        00820000
                  0      MEASSTATXDS       Global statistics            00825000
                 14      IOSTATXDS         I/O stats data               00830000
                 15      MEASPROCXDS       Process level data           00835000
                                                                        00840000
                                                                        00845000
When the class 0 bit of GCLASSENABLEDMASK is found to be                00850000
non-zero, and an event occurs which effects a statistic which is        00855000
maintained in the class 0 portion of the measurement XDS, the           00860000
statistic is directly updated by in-line OS code, the same is           00865000
true for classes 14 and 15. For statiscitcs in other classes,           00870000
updating is performed by calling the procedure:                         00875000
                                                                        00880000
Integer Procedure UPDATESTATISTICS(Class,Subclass,Subclassentry,        00885000
   Startingitem,Newvalueflag,Valuechange,Doubleitemflag);               00890000
   Value Class,Subclass,Subclassentry,Startingitem,Newvalueflag,        00895000
         Valuechange,Doubleitemflag;                                    00900000
   Integer Class,Subclass,Subclassentry,Startingitem;                   00905000
   Double Valuechange;                                                  00910000
   Logical Newvalueflag,Doubleitemflag;                                 00915000
   Option External,Uncallable,Privileged;                               00920000
                                                                        00925000
UPDATESTATISTICS performs class, subclass, entry,and item range         00930000
checking.                                                               00935000
                                                                        00940000
     CC=CCL ==> bad parameter;                                          00945000
     CC=CCE ==> ok;                                                     00950000
     CC=CCG not used                                                    00955000
                                                                        00960000
     UPDATESTATISTICS = 0 ==> ok                                        00965000
                      = 1 ==> stats not enabled                         00970000
                      = 2 ==> bad startingitem parameter                00975000
                      = 3 ==> bad subclassentry parameter               00980000
                      = 4 ==> bad subclass parameter                    00985000
                      = 5 ==> bad class parameter                       00990000
                                                                        00995000
The Newvalueflag parameter, when true, indicates that the               01000000
Valuechange parameter is to replace the old item, and, when             01005000
false, indicates that the valuechange parameter is to be added to       01010000
the old item value.                                                     01015000
                                                                        01020000
The Doubleitemflag parameter, when true, indicates that the             01025000
Valuechange parameter contains a double item value to be up-            01030000
dated, when false, it indicates that the Valuechange parameter          01035000
contains a single item value to be updtated.                            01040000
                                                                        01045000
The current set of classes, subclasses and items are given in           01050000
Appendix 1.  This set can be easily extended for custom measure-        01055000
ments.                                                                  01060000
                                                                        01065000
In addition to the protection provided by this updating                 01070000
procedure, using it saves the user from having to know the              01075000
structure of the measurement XDS.  It provides a centralized            01080000
updating procedure which saves code and makes for easy                  01085000
maintenance when changes in the format of the measurement XDS           01090000
come about.                                                             01095000
                                                                        01100000
UPDATESTATISTICS has an entry point FUPDATESTATISTICS (fast             01105000
update) which can be used when the code has been debugged and           01110000
performance is of significant concern. FUPDATESTATISTICS performs       01115000
the same functions as UPDATESTATISTICS, but omits the parameter         01120000
range checking.  The return value is always zero.                       01125000
                                                                        01130000
$PAGE                                                                   01135000
IV.  Interface Description                                              01140000
                                                                        01145000
                                                                        01150000
The measurement subsystem interface consists of data structures,        01155000
mechanism control procedures, and data access procedures.               01160000
Portions of MPE code know about the current specification of the        01165000
interface, and support its definition by gathering and storing          01170000
the supported information into the appropriate buffers.  The            01175000
information is gathered as events occur, or during sampling or          01180000
trace trap interrupts.                                                  01185000
                                                                        01190000
There are presently 3 classes of statistics gathered: GLOBAL,           01195000
PROCESS, and I/O statistics. The distinction of 3 seperate              01200000
classes was made for the reasons listed below with regard to            01205000
PROCESS statistics which can be applied to the other 2 classes.         01210000
                                                                        01215000
Process level instrumentation has been implemented as a separate        01220000
class (class 15) of statistics. Due to the increased overhead           01225000
incurred during data gathering, the definition of a seperate            01230000
class allows the user to minimize the performance degradation           01235000
when only one class of statistics is required to produce the            01240000
desired information.                                                    01245000
                                                                        01250000
Due to the space requirements for process level counters (52            01255000
words per configured PCB) the class 15 counters will be main-           01260000
tained in a separate extra data segment from that of the global         01265000
counters. Again this will help minimize the performance degra-          01270000
dation of data gathering by reducing the memory space require-          01275000
ments when only one class of statistics is enabled.                     01280000
                                                                        01285000
  A. Interface Data Structures                                          01290000
                                                                        01295000
     The interface data structures consist of :                         01300000
                                                                        01305000
        (i). Control Data Structures                                    01310000
                                                                        01315000
             MEASINFOTAB, a core resident table configured              01320000
             during system generation in which global control           01325000
             information required by the interface is maintained;       01330000
                                                                        01335000
             A block of pcbx fixed cells for maintaining process        01340000
             related control information required for interface         01345000
             support;                                                   01350000
                                                                        01355000
       (ii). Information Storage Structures                             01360000
                                                                        01365000
                                                                        01370000
             Extra data segments into which events are logged,          01375000
             gathered information stored, and in which cumulative       01380000
             statistics are updated;                                    01385000
                                                                        01390000
             PCBX fixed cells containing process specific               01395000
             measurement information.                                   01400000
$PAGE                                                                   01405000
        (i). Control Data Structures                                    01410000
                                                                        01415000
             MEASINFOTAB                                                01420000
                                                                        01425000
             The primary sysglob cells previously used for              01430000
             Measio, Monitor, RTM, DSA, Tracer, and Sampler have        01435000
             been made availble for operating system pointers to        01440000
             new tables (so that future structures can be ac-           01445000
             cessed with the LST instruction).  The measurement         01450000
             control information previously maintained in primary       01455000
             sysglob cells are kept instead in the MEASINFOTAB, a       01460000
             core resident table created for this purpose.  Its         01465000
             structure provides extensibility for both future           01470000
             tools and enhancements to current tools.  There is a       01475000
             pointer to MEASINFOTAB in the primary sysglob area         01480000
             so that the information can be efficiently accessed        01485000
             with the LST instruction.                                  01490000
                                                                        01495000
             The MPE III sysglob assignments related to                 01500000
             measurement tools, and the sampling, event logging         01505000
             and tracing mechanisms, will be supported as in MPE        01510000
             III.  This will permit a gradual conversion to             01515000
             interface requirements.                                    01520000
                                                                        01525000
             %1261 = MEASINFOTABPTR                                     01530000
                   = Sysbase relative index of base of                  01535000
                     MEASINFOTAB                                        01540000
                                                                        01545000
             MEASINFOTAB DST # = 59 (%73)                               01550000
                                                                        01555000
            |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|              01560000
          0 |                                            |              01565000
            |     Reserved for MEASIO Control Info       |              01570000
          7 |                                            |              01575000
            |--------------------------------------------|              01580000
         10 |                                            |              01585000
          . | Reserved for Performance Tuning Parameters |              01590000
         17 |                                            |              01595000
            |--------------------------------------------|              01600000
         20 |                                            |              01605000
          . | Reserved for Statistics Gathering Mechanism|              01610000
          . |        Control Information                 |              01615000
         57 |                                            |              01620000
            |--------------------------------------------|              01625000
         60 |                                            |              01630000
            |  Reserved for Shared Clock Interface User  |              01635000
            |        Control Information                 |              01640000
         67 |                                            |              01645000
            |--------------------------------------------|              01650000
         70 |                                            |              01655000
            |  Reserved for Shared Clock Interface       |              01660000
            |        Control Information                 |              01665000
         77 |                                            |              01670000
            |--------------------------------------------|              01675000
        100 |                                            |              01680000
            |  Reserved for Event Logging Control Info   |              01685000
        117 |                                            |              01690000
            |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|              01695000
                                                                        01700000
$PAGE                                                                   01705000
                                                                        01710000
       The data area for MMSTAT enabling and other MONITOR con-         01715000
       trol will be reserved in the event logging portion of            01720000
       MEASINFOTAB (NOTE: MEASFLAG ABS(%1267) has not been              01725000
       moved).                                                          01730000
                                                                        01735000
       The current assignments for MEASINFOTAB can be found in          01740000
       the SYSTEM TABLES manual in chapter 17.                          01745000
                                                                        01750000
       In addition to these control cells, three primary SYSGLOB        01755000
       cells have been reserved for use by the kernel in low            01760000
       overhead detection of statistics gathering enabled and low       01765000
       overhead access to the statistics information structure.         01770000
       These are :                                                      01775000
                                                                        01780000
       |--------------------------------------------|                   01785000
       |         GCLASSENABLEDMASK                  |%1262              01790000
       |--------------------------------------------|                   01795000
       |         MEASSTATXDSBANK                    |%1263              01800000
       |--------------------------------------------|                   01805000
       |         MEASSTATXDSBASE                    |%1264              01810000
       |--------------------------------------------|                   01815000
                                                                        01820000
                                                                        01825000
                                                                        01830000
 PCBX Fixed Cells for Measurement Control Info                          01835000
                                                                        01840000
       Words %100 through %102 in the pcbx fixed area of a              01845000
       process' stack are reserved for process specific                 01850000
       measurement control information.                                 01855000
                                                                        01860000
       The currently assigned fields of these words are :               01865000
                                                                        01870000
       word %100   PCLASSENABLEDMASK                                    01875000
                                                                        01880000
               .(j:1)=1 ==>  process has enabled and not                01885000
                             disabled statistics class J                01890000
                                                                        01895000
       word %101   MEASSTOPREASON                                       01900000
                                                                        01905000
               = 1 STOPPED, SEGMENT FAULT                               01910000
               = 2 STOPPED, DISC WAIT                                   01915000
               = 3 STOPPED, NON-TERMINAL BLOCKED I/O                    01920000
               = 4 STOPPED, TERM READ                                   01925000
               = 5 STOPPED, IMPEDED                                     01930000
               = 6 STOPPED, ACTIVE (QUANTUM EXPIRATION)                 01935000
                                                                        01940000
       Assignments related to these PXFIXED cells are                   01945000
       coordinated with the master tables.  If additional               01950000
       PXFIXED cells are required, the PXFIXED area can be              01955000
       extended.                                                        01960000
$PAGE                                                                   01965000
      (ii). Information Structures For Measurement Storage              01970000
                                                                        01975000
      Extra Data Segment For the MPE Statistics Gathering               01980000
      Mechanism Global Structure                                        01985000
                                                                        01990000
                                                                        01995000
       |--------------------------------------------|                   02000000
     +-|         MEASSTATXDSBANK                    |%1263              02005000
+----+ |--------------------------------------------|                   02010000
|    +-|         MEASSTATXDSBASE                    |%1264              02015000
|      |--------------------------------------------|                   02020000
|                                                                       02025000
|                                                                       02030000
+----> |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|                   02035000
   0   |                 .                          |                   02040000
   .   | Seg rel offsets to item0 counters for ldevs|                   02045000
   .   |           indexed by ldev                  |                   02050000
  255  |                 .                          |                   02055000
       |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|                   02060000
       |             # of Classes                   |                   02065000
       |--------------------------------------------|    XDS            02070000
    +--|             Class 0 Offset                 |                   02075000
    |  |--------------------------------------------|    For            02080000
+---|--|             Class 1 Offset                 |                   02085000
|   |  |--------------------------------------------| Statistics        02090000
|   |  |                 .                          |                   02095000
|   |  |                 .                          | Gathering         02100000
|   |  |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|                   02105000
|   +->|             # of Subclasses                |                   02110000
|      |--------------------------------------------|                   02115000
|   +--|             Subclass 0 Offset              |                   02120000
|   |  |--------------------------------------------|                   02125000
| +-|--|             Subclass 1 Offset              |                   02130000
| | |  |--------------------------------------------|                   02135000
| | |  |                 .                          |                   02140000
| | |  |                 .                          |                   02145000
| | |  |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|                   02150000
| | +->|                                            |                   02155000
| |    |             Subclass                       |                   02160000
| |    |              Format                        |                   02165000
| |    |                 .                          |                   02170000
| |    |                 .                          |                   02175000
| |    |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|                   02180000
| +--->|                                            |                   02185000
|      |             Subclass                       |                   02190000
|      |              Format                        |                   02195000
|      |                 .                          |                   02200000
|      |                 .                          |                   02205000
|      |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|                   02210000
+----->|                 .                          |                   02215000
       |                 .                          |                   02220000
       |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|                   02225000
$PAGE                                                                   02230000
      XDS Subclass Structure                                            02235000
                                                                        02240000
                                                                        02245000
       |--------------------------------------------|                   02250000
       |                                            |                   02255000
+------| Class Offset (Segment Relative)            |                   02260000
|      |                                            |                   02265000
|      |--------------------------------------------|                   02270000
|                                                                       02275000
|                                                                       02280000
|      |--------------------------------------------|                   02285000
|----->|                                            |                   02290000
 +-----| Subclass Offset (Class relative)           |                   02295000
 |     |                                            |                   02300000
 |     |--------------------------------------------|                   02305000
 |                                                                      02310000
 |                                                                      02315000
 +---> |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|    -              02320000
       |      # of entries in subclass              |                   02325000
       |--------------------------------------------|  Entry 0          02330000
       |      # of words per subclass entry         |                   02335000
       |--------------------------------------------|                   02340000
       |      # of words in entry 0                 |                   02345000
       |--------------------------------------------|    -              02350000
       |              item 0                        |                   02355000
       |--------------------------------------------|                   02360000
       |              item 1                        |  Entry 1          02365000
       |--------------------------------------------|                   02370000
       |                 .                          |                   02375000
       |                 .                          |                   02380000
       |--------------------------------------------|                   02385000
       |              last item                     |                   02390000
       |--------------------------------------------|    -              02395000
       |              item 0                        |                   02400000
       |--------------------------------------------|                   02405000
       |              item 1                        |  Entry 2          02410000
       |--------------------------------------------|                   02415000
       |                 .                          |                   02420000
       |                 .                          |                   02425000
       |--------------------------------------------|                   02430000
       |              last item                     |                   02435000
       |--------------------------------------------|    -              02440000
                         .                                              02445000
                         .                                              02450000
                         .                                              02455000
$PAGE                                                                   02460000
   Extra Data Segment for the Process Level Counters                    02465000
                                                                        02470000
     MEASINFOTABPTR = ABS(%1261)                                        02475000
                                                                        02480000
                 MEASINFOTAB DST(%73)                                   02485000
                                                                        02490000
         |--------------------------------------------|                 02495000
     %0  |                                            |                 02500000
         |--------------------------------------------|                 02505000
      .  |                                            |                 02510000
         |--------------------------------------------|                 02515000
      .  |                                            |                 02520000
         |--------------------------------------------|                 02525000
 +---%21 |            MEASPROCXDSBANK                 |                 02530000
 |       |--------------------------------------------|                 02535000
 +---%22 |            MEASPROCXDSBASE                 |                 02540000
 |       |--------------------------------------------|                 02545000
 |   %23 |            MEASPROCXDSNUM                  |                 02550000
 |       |--------------------------------------------|                 02555000
 |                                                                      02560000
 |                                                                      02565000
 |                                                                      02570000
 |                                                                      02575000
 |       |--------------------------------------------|                 02580000
 +---%0  |               Entry Size                   |                 02585000
         |--------------------------------------------|                 02590000
     %1  |         Number of configured PCB's         |                 02595000
         |--------------------------------------------|                 02600000
     %2  |         Time Sampling Started  (MSW)       |                 02605000
         |--------------------------------------------|                 02610000
     %3  |         Time Sampling Started  (LSW)       |                 02615000
         |--------------------------------------------|                 02620000
     %4  |      1st char       |      2nd char        | MPE Version     02625000
         (base)                                                         02630000
         |--------------------------------------------|                 02635000
     %5  |      1st char       |      2nd char        | MPE Update      02640000
         (base)                                                         02645000
         |--------------------------------------------|                 02650000
     %6  |      1st char       |      2nd char        | MPE Fix         02655000
         (base)                                                         02660000
         |--------------------------------------------|                 02665000
     %7  |      1st char       |      2nd char        | MPE Version     02670000
         (actual)                                                       02675000
         |--------------------------------------------|                 02680000
     %10 |      1st char       |      2nd char        | MPE Update      02685000
     (actual)                                                           02690000
         |--------------------------------------------|                 02695000
     %11 |      1st char       |      2nd char        | MPE Fix         02700000
     (actual)                                                           02705000
         |--------------------------------------------|                 02710000
     %12 |      Memory used by MPE in words (MSW)     |                 02715000
         |--------------------------------------------|                 02720000
     %13 |      Memory used by MPE in words (LSW)     |                 02725000
         |--------------------------------------------|                 02730000
     %14 |      Memory available in words (MSW)       |                 02735000
         |--------------------------------------------|                 02740000
     %15 |      Memory available in words (LSW)       |                 02745000
         |--------------------------------------------|                 02750000
$PAGE                                                                   02755000
      .                                                                 02760000
      .                                                                 02765000
      .                                                                 02770000
         |--------------------------------------------|                 02775000
     %62 |                                            |                 02780000
         |--------------------------------------------|     -           02785000
         |                 Item 0                     |                 02790000
         |--------------------------------------------|                 02795000
         |                 Item 1                     |                 02800000
         |--------------------------------------------|                 02805000
         |                    .                       |  Entry 1        02810000
         |                                            |                 02815000
         |                    .                       |                 02820000
         |--------------------------------------------|                 02825000
         |               Last Item                    |                 02830000
         |--------------------------------------------|     -           02835000
         |                 Item 0                     |                 02840000
         |--------------------------------------------|                 02845000
         |                 Item 1                     |                 02850000
         |--------------------------------------------|                 02855000
         |                    .                       |  Entry 2        02860000
         |                                            |                 02865000
         |                    .                       |                 02870000
         |--------------------------------------------|                 02875000
         |               Last Item                    |                 02880000
         |--------------------------------------------|     -           02885000
         |                 Item 0                     |                 02890000
         |--------------------------------------------|                 02895000
         |                 Item 1                     |                 02900000
         |--------------------------------------------|                 02905000
         |                    .                       |  Entry 3        02910000
         |                                            |                 02915000
         |                    .                       |                 02920000
         |--------------------------------------------|                 02925000
         |               Last Item                    |                 02930000
         |--------------------------------------------|     -           02935000
         |                 Item 0                     |                 02940000
         |--------------------------------------------|                 02945000
         |                 Item 1                     |                 02950000
         |--------------------------------------------|                 02955000
         |                    .                       |  Entry 4        02960000
         |                                            |                 02965000
         |                    .                       |                 02970000
         |--------------------------------------------|                 02975000
         |               LAST ITEM                    |                 02980000
         |--------------------------------------------|     -           02985000
                              .                                         02990000
                              .                                         02995000
                              .                                         03000000
           Last entry number = highest configured PCB                   03005000
                                                                        03010000
           Indexed by PCB number                                        03015000
$PAGE                                                                   03020000
  B. Interface Control Procedures                                       03025000
                                                                        03030000
     Interface control procedures provide the services required         03035000
     for measurement specification, initiation, and termination.        03040000
     Each measurement tool has its own set of control procedures.       03045000
     These tool specific control procedures call general control        03050000
     procedures which set up the measurement environment and            03055000
     enable/disable the measurement activity.                           03060000
                                                                        03065000
     (i).  Controlling the MPE Statistics Gathering Mechanism           03070000
                                                                        03075000
           When statistics gathering has been enabled, MPE code         03080000
           has the responsibility of updating cumulative                03085000
           statistics which are being maintained in an extra data       03090000
           segment acquired, locked and frozen for that                 03095000
           purpose.                                                     03100000
                                                                        03105000
           This Statistics gathering is enabled by calling:             03110000
                                                                        03115000
              Integer Procedure STARTSTATISTICS(Classmask);             03120000
              Value Classmask;                                          03125000
              Logical Classmask;                                        03130000
              Option External,Privileged;                               03135000
                                                                        03140000
              Return Values:                                            03145000
                                                                        03150000
              CC=CCL ==> could not obtain data segment                  03155000
              CC=CCE ==> ok;                                            03160000
              CC=CCG not used                                           03165000
                                                                        03170000
              STARTSTATISTICS = 0 ==> ok                                03175000
                              = 1 ==> no vmem for data segment          03180000
                              = 2 ==> no dst entry avail                03185000
                              = 3 ==> could not lock data seg           03190000
                                                                        03195000
           and disabled by calling :                                    03200000
                                                                        03205000
              Procedure STOPSTATISTICS(Classmask);                      03210000
              Value Classmask;                                          03215000
              Logical Classmask;                                        03220000
              Option External,Privileged;                               03225000
                                                                        03230000
              Return Values:                                            03235000
                                                                        03240000
              CC=CCL ==> bad parameter;                                 03245000
              CC=CCE ==> ok;                                            03250000
              CC=CCG not used                                           03255000
                                                                        03260000
$PAGE                                                                   03265000
           A sysglob cell, called GCLASSENABLEDMASK and currently       03270000
           assigned absolute %1262, is used by MPE to know which        03275000
           statistics classes are currently enabled.                    03280000
                                                                        03285000
           STARTSTATISTIC's Classmask parameter indicates the           03290000
           classes of statistics which the caller wishes to             03295000
           enable.  This mask will be ORed with PCLASSENABLEDMASK       03300000
           in the process' pcbx.  For any classes newly enabled         03305000
           by the process, the corresponding bit in the sysglob         03310000
           cell GCLASSENABLEDMASK will be set, and the                  03315000
           corresponding class counter in MEASINFOTAB will be           03320000
           incremented.                                                 03325000
                                                                        03330000
           STOPSTATISTICS decrements the MEASINFOTAB counter for        03335000
           processes which have enabled a statistics class for          03340000
           each bit which is on in the Classmask parameter and on       03345000
           in the calling process' PCLASSENABLEDMASK.  If a class       03350000
           enabled counter falls to zero, the corresponding bit         03355000
           in GCLASSENABLEDMASK is cleared.  When a process call        03360000
           to STARTSTATISTICS changes GCLASSENABLEDMASK from a          03365000
           zero state, STARTSTATISTICS acquires, formats, locks         03370000
           and freezes an extra data segment into which the stat-       03375000
           istics will be updated.  When a call to STOPSTATISTICS       03380000
           changes GCLASSENABLEDMASK from a nonzero state to            03385000
           zero, STARTSTATISTICS unfreezes, unlocks and releases        03390000
           the extra data segment which was acquired for statis-        03395000
           tics gathering.  If a terminating process'                   03400000
           PCLASSENABLEDMASK is nonzero, the procedure                  03405000
           STOPSTATISTICS will be called on its stack as part of        03410000
           its resource cleanup.                                        03415000
                                                                        03420000
           STARTSTATISTICS and STOPSTATISTICS acquire a new sir         03425000
           called the MEASSIR.  This sir insures that only              03430000
           one process modifies the environment for statistics          03435000
           gathering, and that while the environment is being           03440000
           modified that calls to these procedures will impede          03445000
           the caller until the environment is setup/destroyed.         03450000
                                                                        03455000
           When GCLASSENABLEDMASK is found to be non-zero, system       03460000
           code updates the supported statistics as events              03465000
           effecting them occur.                                        03470000
                                                                        03475000
           Notice that the above specifications limit the number        03480000
           of statistics classes to 16.                                 03485000
                                                                        03490000
$PAGE                                                                   03495000
                                                                        03500000
    Control procedures for the following basic MPE                      03505000
    mechanisms are to be separated from tools which use the             03510000
    mechanisms, and are to be collected into isolated segments.         03515000
                                                                        03520000
    (ii).  Controlling the kernel event logging mechanism               03525000
   (iii).  Controlling the segment trace mechanism                      03530000
    (iv).  Controlling the sampling mechanism                           03535000
                                                                        03540000
                                                                        03545000
$PAGE                                                                   03550000
  C. Interface Access Procedures                                        03555000
                                                                        03560000
     (i). Accessing the Global Statistics updated by MPE's              03565000
          Statistics Updating Mechanism                                 03570000
                                                                        03575000
           The general statistics access procedure is :                 03580000
                                                                        03585000
                Integer Procedure GETSTATISTICS(Class,Subclass,         03590000
                   Startingitem,Wordcount,Where);                       03595000
                Value Class,Subclass,Startingitem,Wordcount;            03600000
                Integer Class,Subclass,Startingitem,Wordcount;          03605000
                Integer Array Where;                                    03610000
                Option External,Privileged;                             03615000
                                                                        03620000
           This procedure may not be called in split stack mode.        03625000
                                                                        03630000
           Desired statistics, expected count, and destination          03635000
           array are identified by the calling parameters.              03640000
                                                                        03645000
           The measurement class, subclass and startingitem             03650000
           parameters, together with the wordcount parameter,           03655000
           identify the desired statistics.  The class, subclass,       03660000
           and item assignments are specified in Appendix 1.            03665000
                                                                        03670000
           The Wordcount value parameter indicates the number of        03675000
           words to be transferred beginning with the subclass          03680000
           word specified by the class, subclass, and starting-         03685000
           item parameters.  The value of wordcount is based on         03690000
           the current definition of the subclasses.  The number        03695000
           of subclass entries and the number of words in each          03700000
           entry can be discovered by calling GETSTATISTICS with        03705000
           a startingitem parameter of -3 for a wordcount of 3.         03710000
           This serves several purposes :                               03715000
                                                                        03720000
              (i). The necessary array size can be determined;          03725000
             (ii). The number of devices of a given type can be         03730000
                   determined in cases where a subclass contains        03735000
                   statistics for all devices in a given class;         03740000
            (iii). Adding statistics to a subclass entry can be         03745000
                   supported in an upward compatible fashion.           03750000
                                                                        03755000
           Reasonability Checking is performed on the incoming          03760000
           parameters, and status is returned through the               03765000
           condition code and procedure value as follows :              03770000
                                                                        03775000
           CC=CCL ==> bad parameter;                                    03780000
           CC=CCE ==> ok;                                               03785000
           CC=CCG not used                                              03790000
                                                                        03795000
           GETSTATISTICS = 0 ==> ok                                     03800000
                         = 1 ==> stats gathering not enabled            03805000
                         = 2 ==> array out of bounds                    03810000
                         = 3 ==> wordcount out of range.                03815000
                         = 4 ==> bad startingitem parameter             03820000
                         = 5 ==> bad subclass parameter                 03825000
                         = 6 ==> bad class parameter                    03830000
                                                                        03835000
                                                                        03840000
           GETSTATISTICS will have an entry point FGETSTATISTICS which  03845000
           can be used when the code has been debugged and performance  03850000
           is of significant concern. FGETSTATISTICS performs the same  03855000
           functions as GETSTATISTICS, but omits the parameter range    03860000
           checking.  The return value is always zero.                  03865000
$PAGE                                                                   03870000
          ***********************************************************   03875000
          *                    NOT IMPLEMENTED                      *   03880000
          ***********************************************************   03885000
     (ii). Accessing the Per Process Statistics updated by MPE's        03890000
           Statistics Updating Mechanism                                03895000
                                                                        03900000
           Per process statistics updated in the process statistics xds 03905000
           by the MPE statistics gathering mechanism are accessed via   03910000
           the procedure :                                              03915000
                                                                        03920000
                Integer Procedure GETPROCSTATS(Allpins,Pin,Firstitem,   03925000
                                               Wordcount,Where);        03930000
                Value Allpins,Pin,Firstitem,Wordcount;                  03935000
                Logical Allpins;                                        03940000
                Integer Pin,Firstitem,Wordcount;                        03945000
                Integer Array Where;                                    03950000
                Option Privileged,Uncallable,External;                  03955000
                                                                        03960000
           This procedure may not be called in split-stack mode.        03965000
                                                                        03970000
           The calling parameters identify a process or all processes,  03975000
           the set of desired statistics, and the destination array.    03980000
           Allpins when set to true, requests information for all pins. 03985000
           The user should expect to retrieve data for both active and  03990000
           inactive pins. That is, it will be the callers responsibilty 03995000
           to determine if the information returned is that of a live   04000000
           process (creation time non-zero and termination time equal to04005000
           zero), or a recently terminated process (creation and term-  04010000
           ination times non-zero), or finally a process which has not  04015000
           yet been created (creation and termination times both equal  04020000
           to zero).  Pin is the process identification number.  To com-04025000
           pute the necessarry size of the output array Where before    04030000
           requesting ALLPINS, the user can first request the first 2   04035000
           items of PIN 0 (header information) which are entry size and 04040000
           number of entrys.  Firstitem and Wordcount parameters relate 04045000
           to the current assignments of process specific measurement   04050000
           items.  The currently supported process statistics and their 04055000
           item assignments are presented in Appendix 2.                04060000
                                                                        04065000
           Reasonability Checking is performed on the incoming param-   04070000
           eters, and status is returned through the condition code and 04075000
           procedure value as follows :                                 04080000
                                                                        04085000
           CC=CCL ==> bad parameter; CC=CCE ==> ok; CC=CCG not used     04090000
                                                                        04095000
           GETPROCSTATS  = 0 ==> ok                                     04100000
                         = 1 ==> stats not enabled                      04105000
                         = 2 ==> array out of bounds                    04110000
                         = 3 ==> bad wordcount                          04115000
                         = 4 ==> bad startingitem parm                  04120000
                         = 5 ==> bad pin parm                           04125000
                                                                        04130000
                                                                        04135000
           GETPROCSTATS will have an entry point FGETPROCSTATS (fast    04140000
           get) which can be used when the code has been debugged and   04145000
           performance is of significant concern. FGETPROCSTATS performs04150000
           the same functions as GETPROCSTATS, but omits the parameter  04155000
           range checking.  The return value is always zero.            04160000
           **********************************************************   04165000
           **********************************************************   04170000
$PAGE                                                                   04175000
Appendix I :  Statistics Class and Subclass Assignments                 04180000
                                                                        04185000
                                                                        04190000
COMMENT : Subclass item numbers for supported items begin with          04195000
          zero and remain static.  Subclass items beginning with        04200000
          1000 are not permanent and are for use by lab tools.          04205000
          Class, subclass and item assignments are to be kept           04210000
          updated in the master tables.                                 04215000
                                                                        04220000
Class  0  Global Statistics (low over-head updating)                    04225000
                                                                        04230000
   Subclass 0 :  Single Word Fixed Counters                             04235000
                                                                        04240000
    # entries = 1                                                       04245000
    entry length = 100                                                  04250000
     item #                                                             04255000
                                                                        04260000
     << items 0-29 reserved for process launch/stop info >>             04265000
                                                                        04270000
       0   #launches                                                    04275000
       1   #stops on blocked disc i/o                                   04280000
       2   #stops on unblocked disc i/o                                 04285000
       3   #stops on sl faults                                          04290000
       4   #sl fault recoveries                                         04295000
       5   #stops on pbx faults                                         04300000
       6   #pbx recoveries                                              04305000
       7   #stops on data absence                                       04310000
       8   #data absence recoveries                                     04315000
       9   #stops on terminal reads                                     04320000
      10   #stops on terminal I/O,not read                              04325000
      11   #stops on stack overflows                                    04330000
      12   #stops on busy sir                                           04335000
      13   #stops on impede                                             04340000
      14   #dl size expansion stops                                     04345000
      15   #dl contractions                                             04350000
      16   #pxfile expansion stops                                      04355000
      17   #pxfile contractions                                         04360000
      18   #db-z expansion stops                                        04365000
      19   #db-z contractions                                           04370000
      20   # data seg expansion stops                                   04375000
      21   # data seg contractions                                      04380000
      22   # timed-out stops                                            04385000
      23   #premptions                                                  04390000
      24   #stops on misc blocked i/o                                   04395000
                                                                        04400000
     << items 30-39 reserved for pause related info >>                  04405000
                                                                        04410000
      30   # pauses with nothing to do                                  04415000
      31   # pauses for disc                                            04420000
      32   # pauses for swap                                            04425000
      33   # pauses for both disc and swap                              04430000
      34   # of attempts at garbage collection                          04435000
$PAGE                                                                   04440000
                                                                        04445000
     << items 40-59 reserved for swap-in info >>                        04450000
                                                                        04455000
      40   # process swap-ins                                           04460000
      41   # memory allocations                                         04465000
      42   # times segment in motion in                                 04470000
      43   # recoveries of overlay candidates                           04475000
      44   # times at process queues                                    04480000
      45   # deferrals                                                  04485000
      46   # swapouts from swapq                                        04490000
      47   # swapouts from dispq                                        04495000
      48   # chops of locality of allocated process                     04500000
      49   # code segments released from main memory                    04505000
      50   # data segments released from main memory                    04510000
      51   # swapq delays                                               04515000
      52   # overlay candidates made recoverable overlay candidates     04520000
      53   # giveups due to more urgent activity pending                04525000
      54   # hardrequests                                               04530000
      55   # times found free space                                     04535000
      56   # swapq successes                                            04540000
      57   # dispq successes                                            04545000
                                                                        04550000
     << items 60-79 reserved for miscellaneous counters                 04555000
                                                                        04560000
      60   # lock requests                                              04565000
      61   # freeze requests                                            04570000
      62   # cancel msgs not processed                                  04575000
      63   # cancel msgs processed                                      04580000
      64   # garbage moves, background                                  04585000
      65   # garbage moves, allocate                                    04590000
      66   # garbage move giveups, preempted                            04595000
      67   # overlap seeks issued                                       04600000
      68   # clock cycles                                               04605000
      69   # makeroom succeses                                          04610000
                                                                        04615000
     << items 80-99 reserved for cpu time consumption info>>            04620000
                                                                        04625000
     80-81  cumulative time paused, idle                                04630000
     82-83  cumulative time paused, swap                                04635000
     84-85  cumulative time paused, disc                                04640000
     86-87  cumulative time paused, swap and disc                       04645000
     88-89  cumulative cpu time on processes                            04650000
     90-91  cumulative cpu time on memory allocation                    04655000
     92-93  cumulative cpu time on garbage collection                   04660000
     94-95  cumulative cpu time on garbage collection, allocation       04665000
$PAGE                                                                   04670000
   Subclass 1 : Disc Subsystem Activity Profile                         04675000
                                                                        04680000
    # entries = # of configured disc's                                  04685000
    entry length = 21                                                   04690000
                                                                        04695000
   item # in each entry                                                 04700000
                                                                        04705000
      0     logical device number                                       04710000
      1     #code segment read completions from this device             04715000
      2     #data segment read completions from this device             04720000
      3     #forced segment write completions to this device            04725000
      4     #background segment write completions to this device        04730000
      5     #blocked disc reads completed against this device           04735000
      6     #blocked disc writes completed to this device               04740000
      7     #unblocked,awake not set disc reads completed               04745000
      8     #unblocked,awake not set disc writes completed              04750000
      9     #unblocked,awake set disc reads completed                   04755000
     10     #unblocked,awake set disc writes completed                  04760000
     11     #buffer traps against this device                           04765000
     12     #times controller busy                                      04770000
     13     #control operations on this device                          04775000
     14     #times queue length = 0                                     04780000
     15     #times queue length = 1                                     04785000
     16     #times queue length = 2                                     04790000
     17     #times queue length = 3                                     04795000
     18     #times queue length = 4                                     04800000
     19     #times queue length = 5                                     04805000
     20     #times queue length = 6                                     04810000
                                                                        04815000
   Subclass 2 : Line Printer Activity Profile                           04820000
                                                                        04825000
    # entries = # of configured line printer's                          04830000
    entry length = 4                                                    04835000
                                                                        04840000
   item # in each entry                                                 04845000
                                                                        04850000
      0     logical device number                                       04855000
      1     #device reads                                               04860000
      2     #device writes                                              04865000
      3     #device control operations                                  04870000
   Subclass 3 : Mag Tape Activity Profile                               04875000
                                                                        04880000
    # entries = # of configured tape drives                             04885000
    entry length = 4                                                    04890000
                                                                        04895000
   item # in each entry                                                 04900000
                                                                        04905000
      0     logical device number                                       04910000
      1     #device reads                                               04915000
      2     #device writes                                              04920000
      3     #device control operations                                  04925000
$PAGE                                                                   04930000
Class 15 : Process Statistics                                           04935000
                                                                        04940000
 Subclass 0                                                             04945000
                                                                        04950000
   Entry Length = 52                                                    04955000
                                                                        04960000
   # entries = # of configured pcb entries                              04965000
                                                                        04970000
 item assignments for each subclass entry                               04975000
  0-3  program name                                                     04980000
  4-7  program group name                                               04985000
  8-11 program account name                                             04990000
  12   job or session number                                            04995000
  13   reason last stopped                                              05000000
  14   #stops sl faults                                                 05005000
  15   #stops, pbx faults                                               05010000
  16   #stops, data seg faults                                          05015000
  17   #stops, segment expansion                                        05020000
  18   #stops, blocked disc i/os issued                                 05025000
  19   #stops, unblocked disc i/os issued                               05030000
  20  #stops, blocked i/os waited on                                    05035000
  21  #stops, terminal read                                             05040000
  22  #stops, impeded)                                                  05045000
  23  #stops, time out (quantum expiration)                             05050000
  24  #stops, preempted                                                 05055000
  25  #stops, rin wait                                                  05060000
  26  # launches                                                        05065000
  27  #swapins                                                          05070000
  28  #overlays caused                                                  05075000
  29  #segment contractions                                             05080000
  30  #disc reads                                                       05085000
  31  #disc writes                                                      05090000
                                                                        05095000
  << items 32-52 reserved for double word counters >>                   05100000
                                                                        05105000
32-33 creation time of process                                          05110000
34-35 termination time of process                                       05115000
36-38 cumulative cpu time used                                          05120000
38-39 cumulative time paused, swap                                      05125000
40-41 cumulative time paused, disc                                      05130000
42-43 cumulative time paused, non-terminal i/o                          05135000
44-45 cumulative time paused, terminal read                             05140000
46-47 cumulative time paused, impeded                                   05145000
48-49 cumulative time paused, active (impeded, preempted)               05150000
50-51 cumulative words transfered, discs                                05155000
***************************************************************         05160000
*                                                             *         05165000
*                                                             *         05170000
*************************************************************>>         05175000
                                                                        05180000
BEGIN                                                                   05185000
                                                                        05190000
$INCLUDE INCLMEAS                                              <<04112>>05195000
$INCLUDE INCLMIFT                                              <<04112>>05200000
$INCLUDE INCLLPDT                                                       05205000
$INCLUDE INCLLDT5                                                       05210000
$INCLUDE PCBFINCL                                              <<07068>>05215000
INTRINSIC TIMER;                                               <<01741>>05220000
                                                               <<01741>>05225000
                                                               <<01741>>05230000
INTEGER STATUS = Q-1,                                                   05235000
        X = X,                                                 <<01836>>05240000
        S0 = S-0;                                                       05245000
                                                                        05250000
INTEGER POINTER CSTI = 1,                                               05255000
                DSTI = 2,                                      <<01741>>05260000
                PCBB = 3,                                      <<01741>>05265000
                IOQTBPTR = 5,                                  <<01836>>05270000
                DISCREQTBPTR = %31,                            <<01836>>05275000
                SYSGLOBEXT = %377;                             <<01741>>05280000
EQUATE MAX'ENT'SIZE = 52, <<SIZE OF PROCESSLEVEL INSTRUMENT.>> <<07397>>05285000
       MAX'PIN'NUM  = 630,<<MAX. # OF PIN CONFIGURED ALLOW >>  <<07397>>05290000
       DRQ'ENT'SIZE = %21;  << WAS %20 FOR MPE IV >>           <<07068>>05295000
                                                                        05300000
                                                               <<01836>>05305000
EQUATE CCG = 0, <<GREATER THAN COND CODE>>                              05310000
       CCL = 1, <<LESS THAN COND CODE   >>                              05315000
       CCE = 2; <<EQUAT TO COND CODE    >>                              05320000
                                                                        05325000
EQUATE VDT'SIZE           = 15,      <<ARRAY SIZE>>            <<M9085>>05330000
       VDT'ENTRY0'SIZE    = 2,                                 <<03107>>05335000
       VDT'ENTRY'SIZE     = 2,                                 <<03107>>05340000
       VDT'NUM'DISCS      = 7,       <<# OF KNOWN VALID DISC>> <<M9085>>05345000
       VDT'NUM'TAPES      = 3,       <<# OF KNOWN CALID TAPE>> <<M9085>>05350000
       VDT'NUM'LPS        = 1,   << # OF KNOWN VALID LPS >>    <<03107>>05355000
       VDT'NUM'ENT'IDX    = 0,                                 <<03107>>05360000
       VDT'ENT'SIZ'IDX    = 1,                                 <<03107>>05365000
       VDT'DEV'TYP'IDX    = 0,                                 <<03107>>05370000
       VDT'DEV'SUB'IDX    = 1,                                 <<03107>>05375000
       CS80'DISC'TYPE     = 3, << DEVICE TYPE FOR CS80 DISCS >><<03107>>05380000
       CS80'TAPE'TYPE     = 3, << DEVICE TYPE FOR CS80 TAPES >><<03107>>05385000
       CS80'7911'SUBTYPE  = 1,                                 <<03107>>05390000
       CS80'7912'SUBTYPE  = 2,                                 <<03107>>05395000
       CS80'7914'SUBTYPE  = 4,                                 <<06148>>05400000
       CS80'7935'SUBTYPE  = 8,                                 <<03107>>05405000
       CS80'LINUS'SUBTYPE = 0,                                 <<03107>>05410000
       CS80'7945'SUBTYPE  = 5,       <<FALSTAFF>>              <<M9085>>05415000
       CS80'9144'SUBTYPE  = 3,       <<BUFFALO >>              <<M9085>>05420000
       STD'DISC'TYPE      = 0,                                 <<03107>>05425000
       STD'TAPE'TYPE      = 24,                                <<03107>>05430000
       STD'LP'TYPE        = 32,                                <<03107>>05435000
       STD'FLOPPY'TYPE    = 2;                                 <<03107>>05440000
                                                               <<03107>>05445000
DEFINE ES    = (0:8)#,  << ENTRY SIZE FIELD OF VDT >>          <<03107>>05450000
       EZS   = (8:8)#,  << ENTRY0 SIZE FIELD OF VDT >>         <<03107>>05455000
       NMI   = (0:1)#,  << NEEDMOREINFO FLAG OF A VDT ENTRY >> <<03107>>05460000
       DTFLD = (1:15)#, << DEV TYPE OF VDT >>                  <<03107>>05465000
       WPE   = (0:8)#;  << WORDS PER ENTRY FIELD >>            <<03107>>05470000
                                                               <<03107>>05475000
DEFINE ABS               = ABSOLUTE#,                                   05480000
       ASMB              = ASSEMBLE#,                                   05485000
       CC                = STATUS.(6:2)#,                               05490000
       PDISABLE          = ASMB(PSDB)#,                                 05495000
       PENABLE           = ASMB(PSEB)#,                                 05500000
       TRAPOFF           = PUSH(STATUS);                                05505000
                           TOS.(2:1) := 0;                              05510000
                           SET(STATUS)#,                                05515000
       ENABLE            = ASMB(SED 1)#,                                05520000
       DISABLE           = ASMB(SED 0)#;                                05525000
                                                                        05530000
DEFINE CLASS0'SUB'OVHD   = CLASS0'SUBCLASSCNT+1+                        05535000
                           CLASS0'SUBCLASSCNT*                          05540000
                           STD'SUBCLASS'OVHD#,                          05545000
       CLASS1'SUB'OVHD   = CLASS1'SUBCLASSCNT+1+                        05550000
                           CLASS1'SUBCLASSCNT*                          05555000
                           STD'SUBCLASS'OVHD#,                          05560000
       CLASS0SIZE = CLASS0'SUB'OVHD+CLASS0'SUB0SIZE+                    05565000
                    CLASS0'SUB1SIZE*NUM'DISCS+                          05570000
                    CLASS0'SUB2SIZE*NUM'LPS+                            05575000
                    CLASS0'SUB3SIZE*NUM'TAPES#,                         05580000
                                                                        05585000
       CLASS1SIZE = CLASS1'SUB'OVHD+CLASS1'SUB0SIZE+                    05590000
                                    CLASS1'SUB1SIZE+                    05595000
                                    CLASS1'SUB2SIZE+                    05600000
                                    CLASS1'SUB3SIZE+                    05605000
                                    CLASS1'SUB4SIZE+                    05610000
                                    CLASS1'SUB5SIZE#,                   05615000
       CLASS15SIZE = (PCBB(0)+1)*CLASS15'SUB0SIZE#,            <<01741>>05620000
                                                                        05625000
       <<THIS IS USED TO GET PCLASSMASK OUT OF PXFIXED AREA>>  <<01741>>05630000
                                                                        05635000
       GETPCLASSMASK = PUSH(Q,DL);    <<GET REGISTERS>>                 05640000
                        ASMB(XCH;LSUB); <<-QREL OFFSET TO DL>> <<04313>>05645000
                       X := S0 - 2;   <<GET DL-B VALUE>>                05650000
                       TOS := PCBXFIXED(X); <<BASE PCBXFIXED>>          05655000
                        ASMB (LSUB);                           <<04313>>05660000
                       PCLASSMASK'IDX:=TOS+%74#,<<-QREL IDX>>  <<07068>>05665000
                                                                        05670000
       PCLASSENABLEMASK = PCBXFIXED(PCLASSMASK'IDX)#,                   05675000
                                                                        05680000
       NUM'DEVICETYPES  = TOTAL'DEVICES(0)#,                            05685000
       NUM'DISCS        = TOTAL'DEVICES(1)#,                            05690000
       NUM'LPS          = TOTAL'DEVICES(2)#,                            05695000
       NUM'TAPES        = TOTAL'DEVICES(3)#,                            05700000
       NUM'TERMS        = TOTAL'DEVICES(4)#;                            05705000
                                                               <<01741>>05710000
DEFINE GLOBALMASK = (0:1)#,                                    <<01741>>05715000
       PROCMASK   = (15:1)#,                                   <<01741>>05720000
       GLOBALSTATSENBLD = GCLASSENABLEDMASK.GLOBALMASK <> 0#,  <<01741>>05725000
       GLOBALSTATREQ    = CLASSMASK.GLOBALMASK <> 0#,          <<01741>>05730000
       PROCSTATSENBLD   = GCLASSENABLEDMASK.PROCMASK <> 0#,    <<01741>>05735000
       PROCSTATREQ      = CLASSMASK.PROCMASK <> 0#;            <<01741>>05740000
DEFINE LOGICALMAPPING = ABSOLUTE(%1220)#;                      <<06401>>05745000
<< EXTERNAL PROCEDURE DECLARATIONS >>                                   05750000
                                                                        05755000
PROCEDURE FREEZE(EN,TEST,PINX);                                         05760000
   VALUE      EN,TEST,PINX;                                             05765000
   INTEGER    EN,PINX;                                                  05770000
   LOGICAL    TEST;                                                     05775000
   OPTION     UNCALLABLE,PRIVILEGED,EXTERNAL;                           05780000
                                                                        05785000
INTEGER PROCEDURE GETDATASEG(MEMSIZE,VDSIZE);                           05790000
   VALUE      MEMSIZE,VDSIZE;                                           05795000
   INTEGER    MEMSIZE,VDSIZE;                                           05800000
   OPTION     UNCALLABLE,PRIVILEGED,EXTERNAL;                           05805000
                                                                        05810000
PROCEDURE LOCKSEG(EN,TEST,PINX);                                        05815000
   VALUE      EN,TEST,PINX;                                             05820000
   INTEGER    EN,PINX;                                                  05825000
   LOGICAL    TEST;                                                     05830000
   OPTION     UNCALLABLE,PRIVILEGED,EXTERNAL;                           05835000
                                                                        05840000
PROCEDURE UNFREEZE(EN,TEST,PINX);                                       05845000
   VALUE      EN,TEST,PINX;                                             05850000
   INTEGER    EN,PINX;                                                  05855000
   LOGICAL    TEST;                                                     05860000
   OPTION     UNCALLABLE,PRIVILEGED,EXTERNAL;                           05865000
                                                                        05870000
PROCEDURE UNLOCKSEG(EN,TEST,PINX);                                      05875000
   VALUE      EN,TEST,PINX;                                             05880000
   INTEGER    EN,PINX;                                                  05885000
   LOGICAL    TEST;                                                     05890000
   OPTION     UNCALLABLE,PRIVILEGED,EXTERNAL;                           05895000
                                                                        05900000
PROCEDURE RELDATASEG(EN);                                               05905000
   VALUE      EN;                                                       05910000
   INTEGER    EN;                                                       05915000
   OPTION     UNCALLABLE,PRIVILEGED,EXTERNAL;                           05920000
                                                                        05925000
LOGICAL PROCEDURE GETSIR(N);                                            05930000
   VALUE      N;                                                        05935000
   LOGICAL    N;                                                        05940000
   OPTION     EXTERNAL;                                                 05945000
                                                                        05950000
PROCEDURE RELSIR(N,T);                                                  05955000
   VALUE      N,T;                                                      05960000
   LOGICAL    N,T;                                                      05965000
   OPTION     EXTERNAL;                                                 05970000
                                                                        05975000
LOGICAL PROCEDURE EXCHANGEDB(IDX);                                      05980000
   VALUE IDX;                                                           05985000
   INTEGER IDX;                                                         05990000
   OPTION EXTERNAL,PRIVILEGED;                                          05995000
                                                                        06000000
PROCEDURE HELP;                                                         06005000
   OPTION EXTERNAL;                                                     06010000
                                                                        06015000
INTEGER PROCEDURE GETENTRY(TYPE);                                       06020000
   VALUE TYPE;                                                          06025000
   INTEGER TYPE;                                                        06030000
   OPTION EXTERNAL;                                                     06035000
                                                                        06040000
PROCEDURE DELAY(T);                                                     06045000
   VALUE T;                                                             06050000
   DOUBLE T;                                                            06055000
   OPTION EXTERNAL;                                                     06060000
                                                                        06065000
                                                                        06070000
DOUBLE PROCEDURE ATTACHIO(LDEV,QMISC,DSTX,ADDR,FUNC,CNT,       <<01741>>06075000
                          P1,P2,FLAGS);                        <<01741>>06080000
  <<CONSTRUCT IOQ ENTRY FOR DISC I/O REQUEST>>                 <<01741>>06085000
  VALUE LDEV,QMISC,DSTX,ADDR,FUNC,CNT,P1,P2,FLAGS;             <<01741>>06090000
  INTEGER  ADDR,   <<OFFSET TO DATA IN DATA SEGMENT,         >><<01741>>06095000
                   <<OFFSET TO DATA FROM DB IN CALLERS STACK,>><<01741>>06100000
                    <<OR INDEX TO A SYSTEM NAMEBUF           >><<01741>>06105000
            CNT,    <<DATA TRANSFER COUNT, + => WORDS,>>       <<01741>>06110000
                    <<                     - => BYTES >>       <<01741>>06115000
           DSTX,    <<DST NUMBER OF DATA SEGMENT>>             <<01741>>06120000
           FUNC,    <<I/O FUCNTION CODE, 0:READ, 1:WRITE>>     <<01741>>06125000
          FLAGS,    <<CONTROL AND SPECIFICATION FLAGS>>        <<01741>>06130000
           LDEV,    <<LOGICAL DEVICE NUMBER>>                  <<01741>>06135000
          QMISC,    <<MISC. PARAMETER FOR THE DEVICE>>         <<01741>>06140000
             P1,    <<DEVICE DEP. PARM -- HODA FOR DISC>>      <<01741>>06145000
             P2;    <<DEVICE DEP. PARM -- LODA FOR DISC>>      <<01741>>06150000
  OPTION UNCALLABLE,PRIVILEGED;                                <<01741>>06155000
  OPTION EXTERNAL;    <<LOCATED IN MPE SEGMENT "HARDRES" (55)>><<01741>>06160000
                                                               <<01741>>06165000
LOGICAL PROCEDURE CHECKALIVE(PIN);                             <<01741>>06170000
   VALUE PIN;                                                  <<01741>>06175000
   INTEGER PIN;                                                <<01741>>06180000
   OPTION PRIVILEGED,EXTERNAL;                                 <<01741>>06185000
                                                               <<06401>>06190000
LOGICAL PROCEDURE LABEL'IS'SL'SEG(PLABEL,PCBPT);               <<06401>>06195000
   VALUE PLABEL,PCBPT;                                         <<06401>>06200000
   INTEGER PLABEL,PCBPT;                                       <<06401>>06205000
   OPTION EXTERNAL;                                            <<06401>>06210000
                                                               <<06401>>06215000
INTEGER PROCEDURE CSTCONV(PLABEL,PCBPT);                       <<06401>>06220000
   VALUE PLABEL,PCBPT;                                         <<06401>>06225000
   INTEGER PLABEL,PCBPT;                                       <<06401>>06230000
   OPTION EXTERNAL;                                            <<06401>>06235000
INTEGER PROCEDURE GET'PHY'CST;                                 <<06401>>06240000
   OPTION EXTERNAL;                                            <<06401>>06245000
                                                               <<01741>>06250000
$PAGE "MPE IV MEASUREMENT INTERFACE (INITVDT)"                 <<03107>>06255000
PROCEDURE INITVDT(TYPE,VDT);                                   <<03107>>06260000
   VALUE TYPE;                                                 <<03107>>06265000
   INTEGER TYPE;                                               <<03107>>06270000
   LOGICAL ARRAY VDT;                                          <<03107>>06275000
   OPTION PRIVILEGED;                                          <<03107>>06280000
                                                               <<03107>>06285000
                                                               <<03107>>06290000
COMMENT                                                        <<03107>>06295000
*************************************************************  <<03107>>06300000
INITVDT will initialize the logical array VDT (VALID DEVICE    <<03107>>06305000
TABLE) with entries of "valid" device TYPES and SUBTYPES.      <<03107>>06310000
The definition of "valid" are those devices the measurement    <<03107>>06315000
interface knows about when measuring I/O performance. In ad-   <<03107>>06320000
dition to type and subtype entries INITVDT will also set a     <<03107>>06325000
flag  (NEEDMOREINFO) true to indicate to the user of the       <<03107>>06330000
table that the device TYPE entry is not sufficient info to     <<03107>>06335000
terminate a search through remainder of VDT (example: type 0   <<03107>>06340000
for devices in DISC class is sufficient info to determine      <<03107>>06345000
whether or not the searcher has found a "valid" device and     <<03107>>06350000
therefore NEEDMOREINFO will be false). It is imperative        <<03107>>06355000
that this procedure be modified any time a new device          <<03107>>06360000
is supported by MPE and falls into the DISC, MAGTAPE,          <<03107>>06365000
or LP device class.                                            <<03107>>06370000
                                                               <<03107>>06375000
Input Parameters:                                              <<03107>>06380000
                                                               <<03107>>06385000
   TYPE:    1=DISC,                                            <<03107>>06390000
            2=LP,                                              <<03107>>06395000
            3=MAGTAPE,                                         <<03107>>06400000
                                                               <<03107>>06405000
Output Parameters: VDT                                         <<03107>>06410000
                                                               <<03107>>06415000
       +-----------------------------+                         <<03107>>06420000
  --   |      # OF ENTRIES           | VDT'NUM'ENT'IDX         <<03107>>06425000
ENTRY0 |-----------------------------|                         <<03107>>06430000
  --   | #WORDS/ENTRY | ENTRY 0 SIZE ! VDT'ENT'SIZ'IDX         <<03107>>06435000
       |-----------------------------|                         <<03107>>06440000
  --   |N|      DEVICE TYPE          | VDT'DEV'TYP'IDX         <<03107>>06445000
ENTRY1 |-----------------------------|                         <<03107>>06450000
  --   |      DEVICE SUBTYPE         | VDT'DEV'SUB'IDX         <<03107>>06455000
       |-----------------------------|                         <<03107>>06460000
  --   |N|      DEVICE TYPE          |                         <<03107>>06465000
ENTRY2 |-----------------------------|                         <<03107>>06470000
  --   |      DEVICE SUBTYPE         |                         <<03107>>06475000
       |-----------------------------|                         <<03107>>06480000
                    .                                          <<03107>>06485000
                    .                                          <<03107>>06490000
       |-----------------------------|                         <<03107>>06495000
LAST-  |N|      DEVICE TYPE          |                         <<03107>>06500000
ENTRY  |-----------------------------|                         <<03107>>06505000
       |      DEVICE SUBTYPE         |                         <<03107>>06510000
       +-----------------------------+                         <<03107>>06515000
                                                               <<03107>>06520000
        N = (0:1) = 1 ==>NEEDMOREINFO                          <<03107>>06525000
                  = 0 ==>DEVICE TYPE IS                        <<03107>>06530000
                         ENOUGH INFO                           <<03107>>06535000
                                                               <<03107>>06540000
                                                               <<03107>>06545000
OPERATION:                                                     <<03107>>06550000
                                                               <<03107>>06555000
INITVDT will initialize the table based on the input           <<03107>>06560000
parameter TYPE. The appropriate initialization will be         <<03107>>06565000
done via a case statement on TYPE. The array size of           <<03107>>06570000
the VDT (VDT'SIZE) will be fixed at the size required          <<03107>>06575000
to table the class of devices with the most known              <<03107>>06580000
valid devices.                                                 <<03107>>06585000
                                                               <<03107>>06590000
*************************************************************  <<03107>>06595000
;                                                              <<03107>>06600000
                                                               <<03107>>06605000
BEGIN                                                          <<03107>>06610000
                                                               <<03107>>06615000
INTEGER I;        << USED AS ENTRY IDX TO VDT >>               <<03107>>06620000
I := 0;                                                        <<03107>>06625000
VDT(VDT'ENT'SIZ'IDX).WPE := VDT'ENTRY'SIZE;                    <<03107>>06630000
VDT(VDT'ENT'SIZ'IDX).EZS  := VDT'ENTRY0'SIZE;                  <<03107>>06635000
                                                               <<03107>>06640000
CASE TYPE OF                                                   <<03107>>06645000
BEGIN                                                          <<03107>>06650000
   ;     << 0 >>                                               <<03107>>06655000
   BEGIN << 1 >>                                               <<03107>>06660000
   VDT(VDT'NUM'ENT'IDX)    := VDT'NUM'DISCS;                   <<03107>>06665000
                                                               <<03107>>06670000
   I := I+VDT'ENTRY'SIZE;  << ENTRY 1 >>                       <<03107>>06675000
   VDT(I)     := STD'DISC'TYPE;                                <<03107>>06680000
   VDT(I).NMI := 0;                                            <<03107>>06685000
   VDT(I+1)   := 0;        << SUBTYPE IS NOT NEEDED >>         <<03107>>06690000
                                                               <<03107>>06695000
   I := I+VDT'ENTRY'SIZE;  << ENTRY 2 >>                       <<03107>>06700000
   VDT(I)     := STD'FLOPPY'TYPE;                              <<03107>>06705000
   VDT(I).NMI := 0;                                            <<03107>>06710000
   VDT(I+1)   := 0;        << SUBTYPE IS NOT NEEDED >>         <<03107>>06715000
                                                               <<03107>>06720000
   I := I+VDT'ENTRY'SIZE;  << ENTRY 3 >>                       <<03107>>06725000
   VDT(I)     := CS80'DISC'TYPE;                               <<03107>>06730000
   VDT(I).NMI := 1;        << NEED MORE INFO >>                <<03107>>06735000
   VDT(I+1)   := CS80'7911'SUBTYPE;                            <<03107>>06740000
                                                               <<03107>>06745000
   I := I+VDT'ENTRY'SIZE;  << ENTRY 4 >>                       <<03107>>06750000
   VDT(I)     := CS80'DISC'TYPE;                               <<03107>>06755000
   VDT(I).NMI := 1;        << NEED MORE INFO >>                <<03107>>06760000
   VDT(I+1)   := CS80'7912'SUBTYPE;                            <<03107>>06765000
                                                               <<03107>>06770000
   I := I+VDT'ENTRY'SIZE;  << ENTRY 5 >>                       <<03107>>06775000
   VDT(I)     := CS80'DISC'TYPE;                               <<03107>>06780000
   VDT(I).NMI := 1;        << NEED MORE INFO >>                <<03107>>06785000
   VDT(I+1)   := CS80'7935'SUBTYPE;                            <<03107>>06790000
                                                               <<06148>>06795000
   I := I+VDT'ENTRY'SIZE;  << ENTRY 7 >>                       <<06148>>06800000
   VDT(I)     := CS80'DISC'TYPE;                               <<06148>>06805000
   VDT(I).NMI := 1;        << NEED MORE INFO >>                <<06148>>06810000
   VDT(I+1)   := CS80'7914'SUBTYPE;                            <<06148>>06815000
                                                                        06820000
   I := I+VDT'ENTRY'SIZE;  <<ENTRY 8>>                         <<M9085>>06825000
   VDT(I)     := CS80'DISC'TYPE;                               <<M9085>>06830000
   VDT(I).NMI := 1;                                            <<M9085>>06835000
   VDT(I+1)   := CS80'7945'SUBTYPE;                            <<M9085>>06840000
                                                               <<M9085>>06845000
   END; << CASE 1 >>                                           <<03107>>06850000
                                                               <<03107>>06855000
   BEGIN << CASE 2 = LP DEVICES >>                             <<03107>>06860000
   VDT(VDT'NUM'ENT'IDX) := VDT'NUM'LPS;                        <<03107>>06865000
   I := I+VDT'ENTRY'SIZE;  << ENTRY 1 >>                       <<03107>>06870000
   VDT(I)     := STD'LP'TYPE;                                  <<03107>>06875000
   VDT(I).NMI := 0;                                            <<03107>>06880000
   VDT(I+1)   := 0;        << SUBTYPE NOT NEEDED >>            <<03107>>06885000
   END; << CASE 2 >>                                           <<03107>>06890000
                                                               <<03107>>06895000
   BEGIN << CASE 3 = MAGTAPE DEVICES >>                        <<03107>>06900000
   VDT(VDT'NUM'ENT'IDX) := VDT'NUM'TAPES;                      <<03107>>06905000
   I := I+VDT'ENTRY'SIZE;  << ENTRY 1 >>                       <<03107>>06910000
   VDT(I)     := STD'TAPE'TYPE;                                <<03107>>06915000
   VDT(I).NMI := 0;                                            <<03107>>06920000
   VDT(I+1)   := 0;        << SUBTYPE IS NOT NEEDED >>         <<03107>>06925000
   I := I+VDT'ENTRY'SIZE;  <<ENTRY2>>                          <<M9085>>06930000
   VDT(I)     := CS80'TAPE'TYPE;                               <<M9085>>06935000
   VDT(I).NMI := 1;         <<NEED MORE INFORMATION>>          <<M9085>>06940000
   VDT(I+1)   := CS80'LINUS'SUBTYPE;                           <<M9085>>06945000
   I := I+VDT'ENTRY'SIZE;  <<ENTRY3>>                          <<M9085>>06950000
   VDT(I)     := CS80'TAPE'TYPE;                               <<M9085>>06955000
   VDT(I).NMI := 1;         <<NEED MORE INFO.>>                <<M9085>>06960000
   VDT(I+1)   := CS80'9144'SUBTYPE;                            <<M9085>>06965000
   END; << CASE 3 >>                                           <<03107>>06970000
END; << CASE CODE >>                                           <<03107>>06975000
END; << INITVDT >>                                             <<03107>>06980000
$PAGE "MPE IV MEASUREMENT INTERFACE (FINDDEVICES)"                      06985000
PROCEDURE FINDDEVICES(TYPE,LDEV'NO);                                    06990000
  VALUE TYPE;                                                           06995000
  INTEGER TYPE;                                                <<02535>>07000000
  INTEGER ARRAY LDEV'NO;  <<(0:1)=no. of devs(1:nn)=ldev no's>>         07005000
  OPTION PRIVILEGED, UNCALLABLE;                               <<04113>>07010000
                                                                        07015000
COMMENT                                                        <<02535>>07020000
***************************************************************<<02535>>07025000
**   FINDDEVICES: Find # of and ldev no's of requested class **         07030000
-------------------------------------------------------------**         07035000
** This procedure examines the logical-physical device table **         07040000
** and the logical device table to find the #of devices and  **         07045000
** ldev #'s of the devices in the requested class (TYPE).This**         07050000
** info is passed backed to the caller in LDEV'NO.           **         07055000
** INPUT PARAMETER:                                          **<<02535>>07060000
**                                                           **<<02535>>07065000
**   TYPE: = 1 ==> DISC                                      **<<02535>>07070000
**         = 2 ==> LP                                        **<<02535>>07075000
**         = 3 ==> MAGTAPE                                   **<<02535>>07080000
**         = 4 ==> TERMINAL                                  **<<02535>>07085000
**         = 5 ==> INP                                       **<<02535>>07090000
**         = 6 ==> DS                                        **<<02535>>07095000
**         = 7 ==> MRJE                                      **<<02535>>07100000
**         = 8 ==> HSI                                       **<<02535>>07105000
**         = 9 ==> SSLC                                      **<<02535>>07110000
**                                                           **<<02535>>07115000
***************************************************************<<02535>>07120000
;                                                              <<02535>>07125000
                                                                        07130000
BEGIN                                                                   07135000
EQUATE                                                         <<07068>>07140000
          LDTMOVECOUNT   = 128,                                         07145000
          LOCLDTSIZE     = LDTMOVECOUNT-1;                     <<07068>>07150000
                                                                        07155000
DEFINE    ADJ'LDEV       = (LDEV-LDTBASEENTRY)#,                        07160000
          DISC'DEVICE    = 0#,                                          07165000
          LINEPRINTER'DEVICE = 32#,                                     07170000
          MAGTAPE'DEVICE  = 24#,                                        07175000
          TERMINAL'DEVICE = 16#,                                        07180000
          INP'DEVICE      = 17#,                               <<02535>>07185000
          DS'DEVICE       = 41#,                               <<02535>>07190000
          MRJE'DEVICE     = 22#,                               <<02535>>07195000
          HSI'DEVICE      = 19#,                               <<02535>>07200000
          SSLC'DEVICE     = 18#,                               <<02535>>07205000
          NUM'DEVICES     = LDEV'NO#,                                   07210000
          VALID'ENTRY     = NOT LPDT'VIRTUAL'DEVICE AND        <<07068>>07215000
                            LPDT'DIT'PTR <> 0#;                <<07068>>07220000
                                                                        07225000
LOGICAL   ERROR,    <<TRUE: UNABLE TO EXAMINE ALL DEVICES>>             07230000
          VALIDDEVICE, << TRUE, FOUND ENTRY IN VDT >>          <<03107>>07235000
          LPDTWORD; <<WORD FROM LOGICAL PHYSICAL DEVICE TABLE>>         07240000
                                                                        07245000
INTEGER   DEVICETYPE,      <<DEVICE TYPE FIELD FROM LDT ENTRY>>         07250000
          DEVICESUBTYPE,  << DEVICE SUBTYPE FROM LDT ENTRY >>  <<03107>>07255000
          LDEV,            <<LOOP VARIABLE>>                            07260000
          LDTBASEENTRY,    <<1ST LDT ENTRY IN LOCAL COPY>>              07265000
          LDTENTRYSIZE,    <<SIZE OF LDT ENTRY>>                        07270000
          LDTLASTENTRY,    <<LAST LDT ENTRY IN LOCAL COPY>>             07275000
          I,                                                   <<03107>>07280000
          LPDT'INDEX,                                          <<07068>>07285000
          LDT'INDEX,                                           <<07068>>07290000
          REQUESTED'DEVICE'TYPE;  << "DEVICE TYPE" OF CLASS  >>         07295000
                                                                        07300000
LOGICAL ARRAY VDT(0:VDT'SIZE);    << PASSED TO INITVDT >>      <<03107>>07305000
LOGICAL ARRAY LDT(0:LOCLDTSIZE);  <<LOCAL COPY OF LDT TABLE>>           07310000
INTEGER ARRAY IVDT(*) = VDT;  <<INTEGER OF VDT>>               <<03107>>07315000
                                                                        07320000
LDEV'NO:=0;                                                             07325000
NUM'DEVICES:=0;                                                         07330000
IF NOT (1 <= TYPE <= 3)  THEN  RETURN;                         <<03107>>07335000
                                                                        07340000
TOS := @LDT;           << SET UP MOVE FOR MFDS, LOCAL COPY >>           07345000
TOS := LDT'DST;        << DST NUMBER OF LDT >>                 <<07068>>07350000
TOS := 0;              << OFFSET INTO DST >>                            07355000
TOS := LDTMOVECOUNT;   << LENGTH OF MOVE >>                             07360000
ASSEMBLE(MFDS 4);      << COPY IN LDT >>                                07365000
                                                                        07370000
LDTENTRYSIZE := LDT'ENTRY'SIZE;                                <<07068>>07375000
LDTBASEENTRY := 0;                                                      07380000
LDTLASTENTRY := LDTMOVECOUNT/LDTENTRYSIZE;                              07385000
                                                                        07390000
<< INITIALIZE VDT FOR THIS CLASS OF DEVICES >>                 <<03107>>07395000
INITVDT(TYPE,VDT);                                             <<03107>>07400000
                                                                        07405000
<<SCAN LPDT AND LDT TO FIND ALL DISCS, MAG TAPES, & LP'S>>              07410000
FOR LDEV := 1 UNTIL INTEGER(LPDT'MAX'ENTRIES) DO               <<07068>>07415000
  BEGIN                                                                 07420000
  LPDT'INDEX := LDEV*SIZE'OF'LPDT'ENTRY;                       <<07068>>07425000
  IF VALID'ENTRY THEN                                                   07430000
      BEGIN                                                             07435000
      <<GUARANTEE LDT ENTRY IS IN LOCAL COPY OF TABLE>>                 07440000
      IF LDEV >= LDTLASTENTRY THEN                                      07445000
        BEGIN                                                           07450000
        TOS := @LDT;              << SET UP MOVE FOR MFDS,>>            07455000
        TOS := LDT'DST;                                        <<07068>>07460000
        TOS := LDEV*LDTENTRYSIZE; << OFFSET INTO DST >>                 07465000
        TOS := LDTMOVECOUNT;      << LENGTH OF MOVE >>                  07470000
        ASSEMBLE(MFDS 4);       << COPY IN LDT >>                       07475000
        LDTBASEENTRY := LDEV;                                           07480000
        LDTLASTENTRY := LDTBASEENTRY+LDTMOVECOUNT/LDTENTRYSIZE;         07485000
        END;                                                   <<02530>>07490000
     <<DETERMINE IF LDEV IS A DEVICE OF INTEREST>>             <<02530>>07495000
     LDT'INDEX := ADJ'LDEV*LDTENTRYSIZE;                       <<07068>>07500000
     DEVICETYPE :=LDT'DEVICE'TYPE;                             <<07068>>07505000
                                                               <<07068>>07510000
     LPDT'INDEX := LDEV*SIZE'OF'LPDT'ENTRY;                    <<07068>>07515000
     DEVICESUBTYPE := LPDT'SUBTYPE;                            <<07068>>07520000
                                                                        07525000
                                                                        07530000
      I := 0;                                                  <<03107>>07535000
      DO BEGIN                                                 <<03107>>07540000
         VALIDDEVICE := FALSE;                                 <<03107>>07545000
         I := I + VDT'ENTRY'SIZE;                              <<03107>>07550000
         IF DEVICETYPE = IVDT(I+VDT'DEV'TYP'IDX).DTFLD THEN    <<03107>>07555000
            BEGIN << HAVE A VALID DEVICE TYPE >>               <<03107>>07560000
            IF VDT(I+VDT'DEV'TYP'IDX).NMI THEN                 <<03107>>07565000
               BEGIN << NEED MORE INFO ON SUBTYPE >>           <<03107>>07570000
               IF DEVICESUBTYPE = IVDT(I+VDT'DEV'SUB'IDX) THEN <<03107>>07575000
                  VALIDDEVICE := TRUE;                         <<03107>>07580000
               END                                             <<03107>>07585000
             ELSE                                              <<03107>>07590000
               VALIDDEVICE := TRUE;                            <<03107>>07595000
            IF VALIDDEVICE THEN                                <<03107>>07600000
               LDEV'NO(NUM'DEVICES:=NUM'DEVICES+1):=LDEV;      <<03107>>07605000
            END;                                               <<03107>>07610000
                                                               <<03107>>07615000
         END                                                   <<03107>>07620000
      UNTIL VALIDDEVICE LOR                                    <<03107>>07625000
            (I >= IVDT(VDT'NUM'ENT'IDX)*VDT'ENTRY'SIZE);       <<03107>>07630000
      END;                                                              07635000
  END;                                                                  07640000
END;  <<FINDDEVICES>>                                                   07645000
$PAGE "MPE IV MEASUREMENT INTERFACE  (GETPCBXMEASINFO)"        <<01741>>07650000
PROCEDURE GETPCBXMEASINFO(PIN,PCBXMEASINFO);                   <<01741>>07655000
   VALUE PIN;                                                  <<01741>>07660000
   LOGICAL ARRAY PCBXMEASINFO;                                 <<01741>>07665000
   INTEGER PIN;                                                <<01741>>07670000
   OPTION PRIVILEGED, UNCALLABLE;                              <<04113>>07675000
                                                               <<01741>>07680000
                                                               <<01741>>07685000
COMMENT                                                        <<01741>>07690000
************************************************************** <<01741>>07695000
THIS PROCEDURE WILL RETRIEVE INFORMATION FOR A PIN FROM THE    <<01741>>07700000
PROCESSES PCB ENTRY AND THE PCBX FIXED AREA. IT WILL NOT       <<01741>>07705000
RETRIEVE ANY DATA FROM THE PCBX AREA FOR SYSTEM PROCESSES.     <<01741>>07710000
                                                               <<01741>>07715000
INPUT PARAMETERS:                                              <<01741>>07720000
                                                               <<01741>>07725000
   PIN: PIN FOR WHICH INFORMATION IS REQUESTED OF              <<01741>>07730000
                                                               <<01741>>07735000
OUTPUT PARAMETER:                                              <<01741>>07740000
                                                               <<01741>>07745000
   PCBXMEASINFO: ARRAY IN WHICH INFORMATION IS RETURNED        <<01741>>07750000
     (0) = JOB/SESSIO NUMBER FROM PCB, (0:2)=1>SESSION         <<01741>>07755000
                                            =2>JOB             <<01741>>07760000
     (1).(0:4) = PROCESESS QUEUE, (0:1)=1 ==> L, (1:1)=1 ==> C <<01741>>07765000
                                  (2:1)=1 ==> D, (3:1)=1 ==> E <<01741>>07770000
     (1).(4:12) = STOPTYPE FROM PCBXFIXED(%101-REASON STOPPED) <<01741>>07775000
     (2) = STOPTIME FROM PCBXFIXED(%102)  TIME PROCESS STOPPED <<01741>>07780000
           DOUBLE WORD FROM TIMER                              <<01741>>07785000
                                                               <<01741>>07790000
RETURN VALUES:                                                 <<01741>>07795000
                                                               <<01741>>07800000
     CC = CCL ==> NOT A VALID PROCESS                          <<01741>>07805000
     CC = CCE ==> OK                                           <<01741>>07810000
     CC = CCG ==> NOT USED                                     <<01741>>07815000
                                                               <<01741>>07820000
OPERATION:                                                     <<01741>>07825000
                                                               <<01741>>07830000
THIS PROCEDURE WILL RETURN THE NECESSARY INFORMATION REQUIRED  <<01741>>07835000
TO INITIALIZE AN ENTRY IN THE PROCESS LEVEL MEASUREMENT XDS.   <<01741>>07840000
THE PROCEDURE WILL ONLY RETURN INFO FROM THE PCBX FOR A        <<01741>>07845000
NON-SYSTEM PROCESS,SINCE MOST INFORMATION IS NOT MAINTAINED    <<01741>>07850000
FOR SYSTEM PROCESSES. THIS PROCEDURE IS ONLY CALLED FROM       <<01741>>07855000
FORMATPROCSEG.THE PROCEDURES REQUIRES BOTH, THAT PIN IS A VALID<<01741>>07860000
PCB ENTRY NUMBER VERIFED BY CHECKALIVE, AND THAT THE CALLER IS <<01741>>07865000
HOLDING THE PCB SIR SO AS TO PREVENT THE PROCESS FROM DYING.   <<01741>>07870000
YOU MAY NOT BE PDISABLED WHEN CALLING THIS PROCEDURE DUE TO THE<<01741>>07875000
POSIBILITY OF TRAPPING ON A STACK.                             <<01741>>07880000
                                                               <<01741>>07885000
************************************************************** <<01741>>07890000
;                                                              <<01741>>07895000
                                                               <<01741>>07900000
BEGIN                                                          <<01741>>07905000
                                                               <<01741>>07910000
EQUATE PXGLOBSIZE   = %14, << PCB EQUATES >>                   <<07068>>07915000
       PCB03        = 3,                                       <<01741>>07920000
       PCB09        = 9,                                       <<01741>>07925000
       PCB05        = 5,                                       <<01741>>07930000
       PCB13        = 13,                                      <<01741>>07935000
       PXF23        = %62, <<J/S NUMBER>>                      <<07068>>07940000
       DPXF41       = %37, <<DOUBLE POINTER>>                  <<07068>>07945000
       PXF101       = %75, <<STOP TYPE >>                      <<07068>>07950000
       PXFIXEDSIZE  = %117;                                    <<01741>>07955000
                                                               <<01741>>07960000
LOGICAL ARRAY PCBXFBUFF(0:PXFIXEDSIZE-1); <<LOCAL COPY>>       <<01741>>07965000
                                                               <<01741>>07970000
DOUBLE ARRAY  DPCBXFBUFF(*) = PCBXFBUFF,  <<LOCAL COPY, DBL>>  <<01741>>07975000
              DPCBXMEASINFO(*) = PCBXMEASINFO;                 <<01741>>07980000
                                                               <<01741>>07985000
DEFINE JSNUMBER    = PCBXMEASINFO(0)#,                         <<01741>>07990000
       PROCQUEUE   = PCBXMEASINFO(1).(0:4)#,                   <<01741>>07995000
       STOPTYPE    = PCBXMEASINFO(1).(4:12)#,                  <<01741>>08000000
       STOPTIME    = DPCBXMEASINFO(1)#,                        <<01741>>08005000
       STKFLD      = (4:12)#,   << WAS (1:10) FOR MPE IV>>     <<07068>>08010000
       PTYPEFLD    = (6:3)#,  <<PROCESS TYPE>>                 <<01741>>08015000
       PCBSIZE     = PCBB(1)#,<<ENTRY SIZE>>                   <<01741>>08020000
       STACKDST    = PCBB(PIN*PCBSIZE+PCB03).STKFLD#,          <<01741>>08025000
       FSPTR       = PCBB(PIN*PCBSIZE+PCB05)#,                 <<01741>>08030000
       PROCESSTYPE =INTEGER(PCBB(PIN*PCBSIZE+PCB09).PTYPEFLD)#,<<01741>>08035000
       NOTSYSTEMPROCESS = PROCESSTYPE<>4 AND PROCESSTYPE <> 6#;<<01741>>08040000
                                                               <<01741>>08045000
<<***********************************************************>><<01741>>08050000
                                                               <<01741>>08055000
CC:=CCE;                                                       <<01741>>08060000
MOVE PCBXMEASINFO:=4(0);                                       <<01741>>08065000
MOVE PCBXFBUFF:=PXFIXEDSIZE(0);                                <<01741>>08070000
                                                               <<01741>>08075000
IF FSPTR <> 0 THEN                                             <<01741>>08080000
   BEGIN <<HAVE A VALID PROCESS>>                              <<01741>>08085000
   PROCQUEUE:=PCBB(PIN*PCBSIZE+PCB13).(1:4);                   <<01741>>08090000
   IF NOTSYSTEMPROCESS THEN                                    <<01741>>08095000
      BEGIN <<COPY PCBX>>                                      <<01741>>08100000
      TOS:=@PCBXFBUFF;                                         <<01741>>08105000
      TOS:=STACKDST;                                           <<01741>>08110000
      TOS:=PXGLOBSIZE;                                         <<01741>>08115000
      TOS:=PXFIXEDSIZE;                                        <<01741>>08120000
      ASMB(MFDS 4);                                            <<01741>>08125000
      JSNUMBER:=PCBXFBUFF(PXF23);                              <<01741>>08130000
      STOPTYPE:=PCBXFBUFF(PXF101);                             <<01741>>08135000
      STOPTIME:=DPCBXFBUFF(DPXF41);                            <<01741>>08140000
      END;                                                     <<01741>>08145000
   END                                                         <<01741>>08150000
ELSE                                                           <<01741>>08155000
   CC:=CCL; <<NOT A VALID PROCESS>>                            <<01741>>08160000
END;                                                           <<01741>>08165000
$PAGE "MPE IV MEASUREMENT INTERFACE    (FORMATSEG)"                     08170000
PROCEDURE FORMATSEG(MEASSTATXDS'SIZE,TOTAL'DEVICES,LDEVTAB);            08175000
  VALUE MEASSTATXDS'SIZE;                                               08180000
  INTEGER MEASSTATXDS'SIZE;                                             08185000
  INTEGER ARRAY TOTAL'DEVICES;                                          08190000
  LOGICAL ARRAY LDEVTAB;                                                08195000
  OPTION PRIVILEGED,UNCALLABLE;                                         08200000
                                                                        08205000
COMMENT                 FORMATSEG                                       08210000
*************************************************************           08215000
                                                                        08220000
  This procedure is used to intitialize and format the xds used         08225000
  for statistics gathering. This procedure is called only from          08230000
  STARTSTATISTICS.                                                      08235000
                                                                        08240000
  INPUT PARAMETERS:                                                     08245000
                                                                        08250000
                                                                        08255000
     MEASSTATXDS'SIZE:  SIZE OF THE DATA SEG TO BE FORMATTED            08260000
     TOTAL'DEVICES: (0:1) IS THE TOTAL # OF DEVICE TYPES THE            08265000
                    INTERFACE KNOWS ABOUT.                              08270000
                    (1) IS THE TOTAL # OF DISCS CONFIGURED              08275000
                    (2) IS THE TOTAL # OF LP'S CONFIG                   08280000
                    (3) IS THE TOTAL # OF TAPES CONFIG                  08285000
                    (4) WILL BE THE TOTAL # OF TERM CONFIG              08290000
     LDEVTAB: 1024 WORD ARRAY INDEXED BY LDEV, CONTANING A      <MPE*V> 08295000
              MAPPING OF LDEVS TO A CLASS, SUBCLASS AND                 08300000
              ENTRY. IT IS FIRST USED TO COMPUTE THE ABS ADDR           08305000
              OF ITEM 0 (LDEVNUMBER) FOR EVERY LDEV ENTRY, ONCE         08310000
              THE LDEV NUMBER IS STORED AWAY, THE SEGMENT               08315000
              RELATIVE OFFSET TO THAT ITEM IS WRITTEN OVER              08320000
              THE ORIGINAL VALUE OF LDEVTAB. AFTER THIS IS              08325000
              DONE FOR ALL DEVICES A MTDS INSTRUCTION IS                08330000
              USED TO COPY THE NEW TABLE TO THE FIRST 256               08335000
              WORDS OF THE DATA SEGMENT.                                08340000
                                                                        08345000
  To avoid the possibity of stack overflow occuring to the              08350000
  calling process, an unbounded local array is defined to               08355000
  start at DB+0 and then DB is set to the xds, intialization is         08360000
  then done by indexing the the local array.                            08365000
*************************************************************           08370000
;                                                                       08375000
                                                                        08380000
BEGIN                                                                   08385000
                                                                        08390000
LOGICAL ARRAY MEASSTAT'XDS(*)=DB+0;  <<USED TO INIT POINTERS>>          08395000
                                                                        08400000
INTEGER DISCCNT,                                                        08405000
        LPCNT,                                                          08410000
        TAPECNT,                                                        08415000
        LOCALCLASS0,                                                    08420000
        CLASSBASE,     <<SEG REL OFFSET>>                               08425000
        SUBBASE,       <<SEG REL OFFSET TO ITEM0>>                      08430000
        ENTRYSIZE,                                                      08435000
        I;     <<UTILITY>>                                              08440000
                                                                        08445000
DEFINE STATBASE         = LDEVTABSIZE#, <<BASE OF STATS IN DS>>         08450000
       NUMCLASS'IDX     = STATBASE+0#,  <<IDX OF CLASS COUNT>>          08455000
       CLASS            = LDEVTAB(I).CFIELD#,                           08460000
       SUBCLASS         = LDEVTAB(I).SFIELD#,                           08465000
       ENTRYNUM         = LDEVTAB(I).EFIELD#,                           08470000
       CLASSBASE'IDX    = CLASS+1#,  <<OFFSET TO CLASS>>                08475000
       SUBBASE'IDX      = SUBCLASS+1#, <<OFFSET TO SUBCLASS>>           08480000
       INT              = INTEGER#,                                     08485000
                                                                        08490000
       << BEGIN CLASS0 DEFINITION >>                                    08495000
                                                                        08500000
       CLASS0'IDX       = STATBASE+1#,  <<INDEX OF CLASS0 PTR>>         08505000
       C0BASE           = MEASSTAT'XDS(CLASS0'IDX)+STATBASE#,           08510000
       C0'SUBCNT'IDX    = C0BASE#,                                      08515000
       C0'SUB0'IDX      = C0BASE+1#,                                    08520000
       C0'SUB1'IDX      = C0BASE+2#,                                    08525000
       C0'SUB2'IDX      = C0BASE+3#,                                    08530000
       C0'SUB3'IDX      = C0BASE+4#,                                    08535000
       C0'SUB0'ENTCNT   = MEASSTAT'XDS(C0'SUB0'IDX)+C0BASE#,            08540000
       C0'SUB0'ENTSIZE  = MEASSTAT'XDS(C0'SUB0'IDX)+C0BASE+1#,          08545000
       C0'SUB0'ENT0SIZE = MEASSTAT'XDS(C0'SUB0'IDX)+C0BASE+2#,          08550000
       C0'SUB1'ENTCNT   = MEASSTAT'XDS(C0'SUB1'IDX)+C0BASE#,            08555000
       C0'SUB1'ENTSIZE  = MEASSTAT'XDS(C0'SUB1'IDX)+C0BASE+1#,          08560000
       C0'SUB1'ENT0SIZE = MEASSTAT'XDS(C0'SUB1'IDX)+C0BASE+2#,          08565000
       C0'SUB2'ENTCNT   = MEASSTAT'XDS(C0'SUB2'IDX)+C0BASE#,            08570000
       C0'SUB2'ENTSIZE  = MEASSTAT'XDS(C0'SUB2'IDX)+C0BASE+1#,          08575000
       C0'SUB2'ENT0SIZE = MEASSTAT'XDS(C0'SUB2'IDX)+C0BASE+2#,          08580000
       C0'SUB3'ENTCNT   = MEASSTAT'XDS(C0'SUB3'IDX)+C0BASE#,            08585000
       C0'SUB3'ENTSIZE  = MEASSTAT'XDS(C0'SUB3'IDX)+C0BASE+1#,          08590000
       C0'SUB3'ENT0SIZE = MEASSTAT'XDS(C0'SUB3'IDX)+C0BASE+2#,          08595000
                                                                        08600000
       << BEGIN CLASS 1 DEFINITION >>                                   08605000
                                                                        08610000
       CLASS1'IDX       = STATBASE+2#,  <<INDEX OF CLASS1 PTR>>         08615000
       C1BASE           = MEASSTAT'XDS(CLASS1'IDX)+STATBASE#,           08620000
       C1'SUBCNT'IDX    = C1BASE#,                                      08625000
       C1'SUB0'IDX      = C1BASE+1#,                                    08630000
       C1'SUB1'IDX      = C1BASE+2#,                                    08635000
       C1'SUB2'IDX      = C1BASE+3#,                                    08640000
       C1'SUB3'IDX      = C1BASE+4#,                                    08645000
       C1'SUB4'IDX      = C1BASE+5#,                                    08650000
       C1'SUB5'IDX      = C1BASE+6#,                                    08655000
       C1'SUB0'ENTCNT   = MEASSTAT'XDS(C1'SUB0'IDX)+C1BASE#,            08660000
       C1'SUB0'ENTSIZE  = MEASSTAT'XDS(C1'SUB0'IDX)+C1BASE+1#,          08665000
       C1'SUB0'ENT0SIZE = MEASSTAT'XDS(C1'SUB0'IDX)+C1BASE+2#,          08670000
       C1'SUB1'ENTCNT   = MEASSTAT'XDS(C1'SUB1'IDX)+C1BASE#,            08675000
       C1'SUB1'ENTSIZE  = MEASSTAT'XDS(C1'SUB1'IDX)+C1BASE+1#,          08680000
       C1'SUB1'ENT0SIZE = MEASSTAT'XDS(C1'SUB1'IDX)+C1BASE+2#,          08685000
       C1'SUB2'ENTCNT   = MEASSTAT'XDS(C1'SUB2'IDX)+C1BASE#,            08690000
       C1'SUB2'ENTSIZE  = MEASSTAT'XDS(C1'SUB2'IDX)+C1BASE+1#,          08695000
       C1'SUB2'ENT0SIZE = MEASSTAT'XDS(C1'SUB2'IDX)+C1BASE+2#,          08700000
       C1'SUB3'ENTCNT   = MEASSTAT'XDS(C1'SUB3'IDX)+C1BASE#,            08705000
       C1'SUB3'ENTSIZE  = MEASSTAT'XDS(C1'SUB3'IDX)+C1BASE+1#,          08710000
       C1'SUB3'ENT0SIZE = MEASSTAT'XDS(C1'SUB3'IDX)+C1BASE+2#,          08715000
       C1'SUB4'ENTCNT   = MEASSTAT'XDS(C1'SUB4'IDX)+C1BASE#,            08720000
       C1'SUB4'ENTSIZE  = MEASSTAT'XDS(C1'SUB4'IDX)+C1BASE+1#,          08725000
       C1'SUB4'ENT0SIZE = MEASSTAT'XDS(C1'SUB4'IDX)+C1BASE+2#,          08730000
       C1'SUB5'ENTCNT   = MEASSTAT'XDS(C1'SUB5'IDX)+C1BASE#,            08735000
       C1'SUB5'ENTSIZE  = MEASSTAT'XDS(C1'SUB5'IDX)+C1BASE+1#,          08740000
       C1'SUB5'ENT0SIZE = MEASSTAT'XDS(C1'SUB5'IDX)+C1BASE+2#,          08745000
       STD'ENTRYCNT     = 2#; <<1 FOR ENTRY 0, 1 FOR DATA>>             08750000
                                                                        08755000
EQUATE CLASS0'OVHD = CLASS0'SUBCLASSCNT+1,                              08760000
       CLASS1'OVHD = CLASS1'SUBCLASSCNT+1,                              08765000
       ENTCNTIDX   = 0, <<WORD 0 OF ITEM 0>>                            08770000
       ENTSIZEIDX  = 1, <<WORD 1 OF ITEM 0>>                            08775000
       ENT0SIZEIDX = 2; <<WORD 2 OF ITEM 0>>                            08780000
                                                                        08785000
                                                                        08790000
<<INITIALIZE LOCAL VARIABLES ,THAT ARE STACK DB REL>>                   08795000
                                                                        08800000
LOCALCLASS0:=CLASS0SIZE;                                                08805000
DISCCNT:=NUM'DISCS;                                                     08810000
LPCNT  :=NUM'LPS;                                                       08815000
TAPECNT:=NUM'TAPES;                                                     08820000
                                                                        08825000
<<PUT DB TO BASE OF XDS>>                                               08830000
                                                                        08835000
EXCHANGEDB(MEASSTATXDS'NUM);    << POINT TO XDS >>                      08840000
                                                                        08845000
MEASSTAT'XDS(0) := 0;           <<MOVE 0 TO 1ST WORD OF XDS>>           08850000
TOS := 1;                       <<TARGET IN XDS FOR MOVE>>              08855000
TOS := 0;                       <<SOURCE IN XDS FOR MOVE>>              08860000
TOS := MEASSTATXDS'SIZE-1;      <<COUNT FOR MOVE>>                      08865000
ASMB(MOVE 3);                   <<ZERO OUT XDS>>                        08870000
                                                                        08875000
<<NOW INTITIALIZE ALL POINTERS IN XDS>>                                 08880000
                                                                        08885000
MEASSTAT'XDS(NUMCLASS'IDX)    := CLASSCOUNT;                            08890000
MEASSTAT'XDS(CLASS0'IDX)      := CLASSCOUNT+1;                          08895000
MEASSTAT'XDS(CLASS1'IDX)      := CLASSCOUNT+1+LOCALCLASS0;              08900000
MEASSTAT'XDS(C0'SUBCNT'IDX)   := CLASS0'SUBCLASSCNT;                    08905000
MEASSTAT'XDS(C0'SUB0'IDX)     := CLASS0'OVHD;                           08910000
MEASSTAT'XDS(C0'SUB1'IDX)     := CLASS0'SUB0SIZE+                       08915000
                                 STD'SUBCLASS'OVHD+                     08920000
                                 CLASS0'OVHD;                           08925000
MEASSTAT'XDS(C0'SUB2'IDX)     := CLASS0'SUB0SIZE+                       08930000
                                 CLASS0'SUB1SIZE*DISCCNT+               08935000
                                 STD'SUBCLASS'OVHD*2+                   08940000
                                 CLASS0'OVHD;                           08945000
MEASSTAT'XDS(C0'SUB3'IDX)     := CLASS0'SUB0SIZE+                       08950000
                                 CLASS0'SUB1SIZE*DISCCNT+               08955000
                                 CLASS0'SUB2SIZE*LPCNT+                 08960000
                                 STD'SUBCLASS'OVHD*3+                   08965000
                                 CLASS0'OVHD;                           08970000
MEASSTAT'XDS(C0'SUB0'ENTCNT)  := STD'ENTRYCNT;                          08975000
MEASSTAT'XDS(C0'SUB0'ENTSIZE) := CLASS0'SUB0SIZE;                       08980000
MEASSTAT'XDS(C0'SUB0'ENT0SIZE):= STD'SUBCLASS'OVHD;                     08985000
MEASSTAT'XDS(C0'SUB1'ENTCNT)  := 1+1*DISCCNT;                           08990000
MEASSTAT'XDS(C0'SUB1'ENTSIZE) := CLASS0'SUB1SIZE;                       08995000
MEASSTAT'XDS(C0'SUB1'ENT0SIZE):= STD'SUBCLASS'OVHD;                     09000000
MEASSTAT'XDS(C0'SUB2'ENTCNT)  := 1+1*LPCNT;                             09005000
MEASSTAT'XDS(C0'SUB2'ENTSIZE) := CLASS0'SUB2SIZE;                       09010000
MEASSTAT'XDS(C0'SUB2'ENT0SIZE):= STD'SUBCLASS'OVHD;                     09015000
MEASSTAT'XDS(C0'SUB3'ENTCNT)  := 1+1*TAPECNT;                           09020000
MEASSTAT'XDS(C0'SUB3'ENTSIZE) := CLASS0'SUB3SIZE;                       09025000
MEASSTAT'XDS(C0'SUB3'ENT0SIZE):= STD'SUBCLASS'OVHD;                     09030000
                                                                        09035000
<< INTITIALIZE CLASS1 POINTERS >>                                       09040000
                                                                        09045000
MEASSTAT'XDS(C1'SUBCNT'IDX):=CLASS1'SUBCLASSCNT;                        09050000
MEASSTAT'XDS(C1'SUB0'IDX):=CLASS1'OVHD;                                 09055000
MEASSTAT'XDS(C1'SUB1'IDX):=CLASS1'SUB0SIZE+                             09060000
                           STD'SUBCLASS'OVHD+                           09065000
                           CLASS1'OVHD;                                 09070000
MEASSTAT'XDS(C1'SUB2'IDX):=CLASS1'SUB0SIZE+                             09075000
                           CLASS1'SUB1SIZE+                             09080000
                           STD'SUBCLASS'OVHD*2+                         09085000
                           CLASS1'OVHD;                                 09090000
MEASSTAT'XDS(C1'SUB3'IDX):=CLASS1'SUB0SIZE+                             09095000
                           CLASS1'SUB1SIZE+                             09100000
                           CLASS1'SUB2SIZE+                             09105000
                           STD'SUBCLASS'OVHD*3+                         09110000
                           CLASS1'OVHD;                                 09115000
MEASSTAT'XDS(C1'SUB4'IDX):=CLASS1'SUB0SIZE+                             09120000
                           CLASS1'SUB1SIZE+                             09125000
                           CLASS1'SUB2SIZE+                             09130000
                           CLASS1'SUB3SIZE+                             09135000
                           STD'SUBCLASS'OVHD*4+                         09140000
                           CLASS1'OVHD;                                 09145000
MEASSTAT'XDS(C1'SUB5'IDX):=CLASS1'SUB0SIZE+                             09150000
                           CLASS1'SUB1SIZE+                             09155000
                           CLASS1'SUB2SIZE+                             09160000
                           CLASS1'SUB3SIZE+                             09165000
                           CLASS1'SUB4SIZE+                             09170000
                           STD'SUBCLASS'OVHD*5+                         09175000
                           CLASS1'OVHD;                                 09180000
MEASSTAT'XDS(C1'SUB0'ENTCNT)   :=  STD'ENTRYCNT;                        09185000
MEASSTAT'XDS(C1'SUB0'ENTSIZE)  :=  CLASS1'SUB0SIZE;                     09190000
MEASSTAT'XDS(C1'SUB0'ENT0SIZE) :=  STD'SUBCLASS'OVHD;                   09195000
MEASSTAT'XDS(C1'SUB1'ENTCNT)   :=  STD'ENTRYCNT;                        09200000
MEASSTAT'XDS(C1'SUB1'ENTSIZE)  :=  CLASS1'SUB1SIZE;                     09205000
MEASSTAT'XDS(C1'SUB1'ENT0SIZE) :=  STD'SUBCLASS'OVHD;                   09210000
MEASSTAT'XDS(C1'SUB2'ENTCNT)   :=  STD'ENTRYCNT;                        09215000
MEASSTAT'XDS(C1'SUB2'ENTSIZE)  :=  CLASS1'SUB2SIZE;                     09220000
MEASSTAT'XDS(C1'SUB2'ENT0SIZE) :=  STD'SUBCLASS'OVHD;                   09225000
MEASSTAT'XDS(C1'SUB3'ENTCNT)   :=  STD'ENTRYCNT;                        09230000
MEASSTAT'XDS(C1'SUB3'ENTSIZE)  :=  CLASS1'SUB3SIZE;                     09235000
MEASSTAT'XDS(C1'SUB3'ENT0SIZE) :=  STD'SUBCLASS'OVHD;                   09240000
MEASSTAT'XDS(C1'SUB4'ENTCNT)   :=  STD'ENTRYCNT;                        09245000
MEASSTAT'XDS(C1'SUB4'ENTSIZE)  :=  CLASS1'SUB4SIZE;                     09250000
MEASSTAT'XDS(C1'SUB4'ENT0SIZE) :=  STD'SUBCLASS'OVHD;                   09255000
MEASSTAT'XDS(C1'SUB5'ENTCNT)   :=  STD'ENTRYCNT;                        09260000
MEASSTAT'XDS(C1'SUB5'ENTSIZE)  :=  CLASS1'SUB5SIZE;                     09265000
MEASSTAT'XDS(C1'SUB5'ENT0SIZE) :=  STD'SUBCLASS'OVHD;                   09270000
                                                                        09275000
EXCHANGEDB(0);                                                          09280000
                                                                        09285000
<<FINALLY PUT LDEV #'S IN APPROPRIATE ENTRYS>>                          09290000
                                                                        09295000
I:=-1; <<INITIALIZE>>                                                   09300000
WHILE (I:=I+1) < LDEVTABSIZE DO                                <<07187>>09305000
   BEGIN                                                                09310000
   IF LDEVTAB(I) <> 0 THEN                                              09315000
      BEGIN                                                             09320000
      TOS:=MEASSTATXDSBANK;                                             09325000
      TOS:=LOGICAL(MEASSTATXDSBASE)+LOGICAL(LDEVTABSIZE);      <<L7516>>09330000
      TOS:=TOS+CLASSBASE'IDX;     <<ABS ADDR OF CLASSBASE PTR>>         09335000
      ASMB(LSEA);                 <<PULL OUT OFFSET TO CLASS >>         09340000
      CLASSBASE:=TOS;                                                   09345000
                                                                        09350000
      <<NOW GET SEGRELOFF FOR SUBCLASS>>                                09355000
                                                                        09360000
      TOS:=CLASSBASE-INT(CLASSBASE'IDX)+INT(SUBBASE'IDX);               09365000
      ASMB(LADD;LSEA);       <<ABS ADDR OF CLASSBASE PTR>>              09370000
      SUBBASE:=TOS+CLASSBASE;<<SEGREL OFFSET TO BASE OF SUB>>           09375000
                                                                        09380000
      TOS:=SUBBASE-CLASSBASE-INT(SUBBASE'IDX)+ENTSIZEIDX;               09385000
      ASMB(LADD;LSEA);                                                  09390000
      ENTRYSIZE:=TOS;                                                   09395000
                                                                        09400000
      TOS:=(INT(ENTRYNUM)-1)*ENTRYSIZE+ENT0SIZEIDX;                     09405000
      ASMB(LADD); <<TOS NOW HAS ABS ADDR OF ITEM0>>                     09410000
      TOS:=I;     <<LDEV NUM>>                                          09415000
      ASMB(SSEA);                                                       09420000
      TOS:=MEASSTATXDSBASE;                                             09425000
      ASMB(LSUB); <<TOS HAS SEGRELATIVE OFFSET FOR ITEM 0>>             09430000
      LDEVTAB(I):=TOS; <<DONT NEED ORIGINAL INFO OF LDEVTAB>>           09435000
      ASMB(DEL); <<BANK>>                                               09440000
                                                                        09445000
      END;                                                              09450000
   END;                                                                 09455000
                                                                        09460000
<<LDEVTAB NOW CONTAINS SEGMENT RELATIVE OFFSETS TO ITEM 0>>             09465000
<<FOR ALL DEVICES THE INTERFACE KNOWS ABOUT >>                          09470000
                                                                        09475000
<<MOVE LDEVTAB TO FIRST 1024 WORDS OF SEGMENT>>                <<07187>>09480000
                                                                        09485000
TOS:=MEASSTATXDS'NUM;                                                   09490000
TOS:=0;               <<START AT WORD 0>>                               09495000
TOS:=@LDEVTAB;        <<SOURCE ADDRESS>>                                09500000
TOS:=LDEVTABSIZE;     <<WORD COUNT FOR MOVE>>                           09505000
ASMB(MTDS 4);                                                           09510000
                                                                        09515000
END;                                                                    09520000
$PAGE  "MPE IV MEASUREMENT INTERFACE    (FORMATPROCSEG)"       <<01741>>09525000
PROCEDURE FORMATPROCSEG(MEASPROCXDS'SIZE);                     <<01741>>09530000
   VALUE MEASPROCXDS'SIZE;                                     <<01741>>09535000
   INTEGER MEASPROCXDS'SIZE;                                   <<01741>>09540000
   OPTION PRIVILEGED,UNCALLABLE;                               <<01741>>09545000
                                                               <<01741>>09550000
COMMENT                                                        <<01741>>09555000
************************************************************** <<01741>>09560000
                                                               <<01741>>09565000
THIS PROCEDURE IS USED TO INITIALIZE AND FORMAT THE PROCESS    <<01741>>09570000
LEVEL STATISTICS XDS AND IS CALLED ONLY FROM STARTSTATISTICS   <<01741>>09575000
                                                               <<01741>>09580000
INPUT PARAMETER:                                               <<01741>>09585000
    MEASPROCXDS'SIZE: SIZE OF XDS TO BE FORMATTED              <<01741>>09590000
                                                               <<01741>>09595000
OPERATION:                                                     <<01741>>09600000
                                                               <<01741>>09605000
  FORMATPROCSEG WILL GRAB THE LOADER AND PCB SIRS TO PREVENT   <<01741>>09610000
  ANY INCONSISTENCY BETWEEN THE PCB AND LSTDIR TABLES DURRING  <<01741>>09615000
  INITIALIZATION. AFTER THE XDS IS ZEROED OUT, EXCHANGEDB IS   <<01741>>09620000
  CALLED TO SET DB TO THE LSTDIR TABLE. WHEN A SHARER          <<01741>>09625000
  ENTRY IS FOUND ATTACHIO IS USED TO MOVE THE PROGRAM NAME     <<01741>>09630000
  DIRECTLY INTO THE XDS. THE DISC ADDR FOR ATTACHIO IS OB-     <<01741>>09635000
  TAINED FROM THE FID FIELD OF THE SHARER ENTRY. NEXT, ALL     <<01741>>09640000
  ENTRIES FOR CURRENTLY ACTIVE PINS ARE TIMESTAMPED, PROCESSES <<01741>>09645000
  NOT RUNNUNG A PROGRAM ARE NAMED AS EITHER 'CI' OR 'SP' PRO-  <<01741>>09650000
  CESSES DEPENDING ON THE PROCESS TYPE FIELD IN THE PCB TABLE. <<01741>>09655000
  NEXT, THE NAMES OF SYSTEM PROCESSES CREATED BY PROGEN ARE    <<01741>>09660000
  MOVED TO THE XDS. THIS IS DONE BY PULLING OUT PCB ENTRY #'S  <<01741>>09665000
  FROM SYSGLOB CELLS WHICH CORRESPOND TO SPECIFIC SP'S.        <<01741>>09670000
  FINNALY, ENTRY0 (CONTROL INFO) IS INTITIALIZED.              <<01741>>09675000
                                                               <<01741>>09680000
************************************************************** <<01741>>09685000
;                                                              <<01741>>09690000
                                                               <<01741>>09695000
BEGIN                                                          <<01741>>09700000
                                                               <<01741>>09705000
EQUATE LSTDIRDST = %22,                                        <<01741>>09710000
       LOADERSIR = 1,                                          <<01741>>09715000
       SHARER    = 6,        <<LST ENTRY TYPE>>                <<01741>>09720000
       SYSPINSBASE  = %1141, <<SYSGLOB>>                       <<01741>>09725000
       PCBSIR    = 34,                                         <<01836>>09730000
       SYSPINSLIMIT = %1154, <<SYSGLOB>>                       <<01741>>09735000
       FIRSTADDR    = 2,     <<OF LINKED MEMORY>>              <<01741>>09740000
       LASTBANKADDR = %1362, <<SYSGLOB>>                       <<01741>>09745000
       REGHEADSIZE  = 9,                                       <<01741>>09750000
       SUBREGHEADSIZE = 15,      << 10 FOR MPE IV >>           <<07068>>09755000
       ENTRYSIZEX   = 0, <<** ENTRY 0 INDICES **>>             <<01741>>09760000
       NUMENTRYSX   = 1,                                       <<01741>>09765000
       DCREATETIMEX = 1, <<DOUBLE IDX>>                        <<01741>>09770000
       BASEVERX     = 4, <<BASE==> FROM SYSGLOB EXT AREA>>     <<01741>>09775000
       BASEUPDX     = 5,                                       <<01741>>09780000
       BASEFIXX     = 6,                                       <<01741>>09785000
       ACTVERX      = 7, <<ACT==> FROM SYSGLOB AREA>>          <<01741>>09790000
       ACTUPDX      = 8,                                       <<01741>>09795000
       ACTFIXX      = 9,                                       <<01741>>09800000
       MPEMEMX      = 5, <<DOUBLE IDX>>                        <<01741>>09805000
       AVAILMEMX    = 6, <<DOUBLE IDX, *END ENTRY 0 INDICES*>> <<01741>>09810000
       DSTOPTIMEX   = 1, <<DOUBLE IDX, FOR PCBXMEASINFO>>      <<01741>>09815000
       CIPROCESS    = 2; <<PROCESS TYPE IN PCB>>               <<01741>>09820000
                                                               <<01741>>09825000
INTEGER BASE, <<CURRENT POINTER IN LSTDIR>>                    <<01741>>09830000
        PIN:=0,  <<LOOP VARIABLE=PIN NUMBER>>                  <<01741>>09835000
        SYSPINSBASEX:=%1140,                                   <<01741>>09840000
        LSTDIRLIMIT,                                           <<01741>>09845000
        SHARERFWRDLINK,  << FORWARD LINK OF TYPE 6 >>          <<07068>>09850000
        PCBSIZE;                                               <<01741>>09855000
                                                               <<01741>>09860000
                                                               <<01741>>09865000
DOUBLE CREATETIME;                                             <<01741>>09870000
                                                               <<01741>>09875000
LOGICAL MYSIR,     <<USED FOR LOADER SIR>>                     <<01741>>09880000
        MYSIR2;    <<USED FOR PCB SIR>>                        <<01741>>09885000
                                                               <<01741>>09890000
LOGICAL ARRAY LSTDIR(*) = DB+0,      <<USED FOR EXCHANGEDB>>   <<01741>>09895000
              MEASPROCXDS(*) = DB+0, <<USED TO INIT XDS TO 0>> <<01741>>09900000
              ENTRY0(0:CLASS15'SUB0SIZE), <<TO INIT ENTRY0>>   <<01741>>09905000
              PCBXMEASINFO(0:3);  <<(0)=JSNUM>>                <<01741>>09910000
                                  <<(1)= STOPWORD>>            <<01741>>09915000
                                  <<(2:2)=STOPTIME>>           <<01741>>09920000
                                                               <<01741>>09925000
DOUBLE ARRAY DENTRY0(*)=ENTRY0,                                <<01741>>09930000
             DPCBXMEASINFO(*)=PCBXMEASINFO,                    <<01741>>09935000
             STOPTIME(*)=DPCBXMEASINFO(DSTOPTIMEX);            <<01741>>09940000
                                                               <<01741>>09945000
BYTE ARRAY PROCNAMES(*)=PB:=  <<NAMES OF SYSTEM PROCESSES>>    <<01741>>09950000
  "PROGEN    ",                                                <<01741>>09955000
  "          ",                                                <<01741>>09960000
  "UCOP      ",                                                <<01741>>09965000
  "PFAIL     ",                                                <<01741>>09970000
  "DEVREC    ",                                                <<01741>>09975000
  "DRUSG     ",                                                <<01741>>09980000
  "STMSG     ",                                                <<01741>>09985000
  "LOG       ",                                                <<01741>>09990000
  "LOAD      ",                                                <<01741>>09995000
  "IOMESSPROC",                                                <<01741>>10000000
  "SYSIOPROC ",                                                <<01741>>10005000
  "MEMLOGP   ";                                                <<01741>>10010000
                                                               <<01741>>10015000
ARRAY NAMEBUF(0:12), <<FILE NAME BUFFER>>                      <<01741>>10020000
      CINAME(0:1),                                             <<01741>>10025000
      SPNAME(0:1);                                             <<01741>>10030000
                                                               <<01741>>10035000
BYTE ARRAY BNAMEBUF(*)=NAMEBUF;                                <<01741>>10040000
                                                               <<01741>>10045000
DEFINE  PINN  = LSTDIR(BASE+1)#,                               <<07068>>10050000
        LDEV  = LSTDIR(BASE+2).(0:8)#,                         <<07068>>10055000
        HODA  = LSTDIR(BASE+2).(8:8)#,                         <<07068>>10060000
        LODA  = LSTDIR(BASE+3)#;                               <<07068>>10065000
                                                               <<01741>>10070000
DEFINE SYSGLOBVER   = ABS(%1116)#,                             <<01741>>10075000
       SYSGLOBUPD   = ABS(%1114)#,                             <<01741>>10080000
       SYSGLOBFIX   = ABS(%1115)#,                             <<01741>>10085000
       BASEVER      = SYSGLOBEXT(%74)#,                        <<01741>>10090000
       BASEUPD      = SYSGLOBEXT(%75)#,                        <<01741>>10095000
       BASEFIX      = SYSGLOBEXT(%76)#,                        <<01741>>10100000
       FULLBANKSIZE = 65536D#,                                 <<01741>>10105000
       NBANKS       = ABS(%1047)#; <<NUMBER OF CONFIG BANKS>>  <<01741>>10110000
                                                               <<01741>>10115000
DEFINE LINKMEMSTART = SYSGLOBEXT(FIRSTADDR)-                   <<01741>>10120000
                      (REGHEADSIZE+SUBREGHEADSIZE)#,           <<01741>>10125000
       LASTBANKSIZE = DOUBLE(LOGICAL(ABS(LASTBANKADDR)))+1D#;  <<01741>>10130000
                                                               <<01741>>10135000
DEFINE PCBENTRYSIZE = PCBB(1)#,                                <<01741>>10140000
       PROCESSTYPE = PCBB(PIN*PCBSIZE+9).(6:3)#,               <<01741>>10145000
       SYSTEMPROCESS = (PROCESSTYPE = 4 OR PROCESSTYPE = 6)#,  <<01741>>10150000
       MAXCONFIGPCB  = PCBB(0)#;                               <<01741>>10155000
                                                               <<01741>>10160000
MOVE CINAME:="CI";                                             <<01741>>10165000
MOVE SPNAME:="SP";                                             <<01741>>10170000
                                                               <<01741>>10175000
<<INITIALIZE PROCESS STATS DATA SEG>>                          <<01741>>10180000
EXCHANGEDB(MEASPROCXDSNUM);                                    <<01741>>10185000
MEASPROCXDS(0):=0; <<MOVE 0 TO 1ST WORD OF XDS>>               <<01741>>10190000
TOS:=1;            <<TARGET FOR MOVE>>                         <<01741>>10195000
TOS:=0;            <<SOURCE IN XDS FOR MOVE>>                  <<01741>>10200000
TOS:=MEASPROCXDS'SIZE-1; <<NUM WORDS TO MOVE>>                 <<01741>>10205000
ASMB(MOVE 3);      <<ZERO OUT XDS>>                            <<01741>>10210000
EXCHANGEDB(0);     <<GET BACK TO STACK>>                       <<01741>>10215000
                                                               <<01741>>10220000
<<GET LOADER SIR AND PDISABLE TO PREVENT CHGS TO LSTDIR>>      <<01741>>10225000
                                                               <<01741>>10230000
MYSIR:=GETSIR(LOADERSIR);                                      <<01741>>10235000
MYSIR2:=GETSIR(PCBSIR);                                        <<01741>>10240000
                                                               <<01741>>10245000
<<SEARCH TROUGH THE LSTDIR AND FIND ALL SHARER ENTRIES>>       <<01741>>10250000
                                                               <<01741>>10255000
EXCHANGEDB(LSTDIRDST);                                         <<01741>>10260000
                                                               <<01741>>10265000
BASE := LSTDIR(26); <<FORWARD LINK OF TYPE6- SHARER>>          <<07068>>10270000
PCBSIZE:=PCBENTRYSIZE;                                         <<01741>>10275000
TRAPOFF;   <<*** TURN TRAPS OFF  FOR ATTACHIO CALL ***>>       <<01741>>10280000
                                                               <<01741>>10285000
WHILE BASE <>0  DO << FORWARD LINK POINT TO NEXT ENTRY >>      <<07068>>10290000
      BEGIN <<CALL ATACHIO AND MOVE PROG NAME TO ENTRY>>       <<01741>>10295000
      TOS:=ATTACHIO(LDEV,0,MEASPROCXDSNUM,                     <<01741>>10300000
                    PINN*CLASS15'SUB0SIZE,0,12,HODA,LODA,1);   <<01741>>10305000
      DEL;                                                     <<01741>>10310000
      IF TOS.(8:8) <> 1 THEN                                   <<01741>>10315000
         BEGIN <<ATTACHIO FAILED>>                             <<01741>>10320000
         MOVE NAMEBUF:=12(" ");                                <<01741>>10325000
         TOS:=MEASPROCXDSNUM;                                  <<01741>>10330000
         TOS:=PINN*CLASS15'SUB0SIZE;                           <<01741>>10335000
         TOS:=@NAMEBUF;                                        <<01741>>10340000
         TOS:=12; <<12 WORDS FOR PROG FILE NAME>>              <<01741>>10345000
         ASMB(MTDS 4);                                         <<01741>>10350000
         END; <<ERROR>>                                        <<01741>>10355000
   BASE := LSTDIR(BASE-3);                                     <<07068>>10360000
   END; <<WHILE LOOP>>                                         <<01741>>10365000
                                                               <<01741>>10370000
EXCHANGEDB(0); <<GET BACK TO STACK FOR REST OF INIT>>          <<01741>>10375000
                                                               <<01741>>10380000
<<FOR EVERY ACTIVE PROCESS, STUFF AWAY CREATION TIME,>>        <<01741>>10385000
<<IF PROCESS IS A CI OR SYSTEM PROCESS THEN PUT EITHER>>       <<01741>>10390000
<<"SP" OR "CI" IN NAME FIELD>>                                 <<01741>>10395000
                                                               <<01741>>10400000
CREATETIME:=TIMER;                                             <<01741>>10405000
WHILE (PIN:=PIN+1) <= MAXCONFIGPCB-1 DO                        <<07397>>10410000
   BEGIN                                                       <<01741>>10415000
   IF CHECKALIVE(PIN) THEN                                     <<01741>>10420000
      BEGIN <<FOUND ACTIVE PROCESS>>                           <<01741>>10425000
      GETPCBXMEASINFO(PIN,PCBXMEASINFO);                       <<01741>>10430000
      IF STOPTIME = 0D THEN                                    <<01741>>10435000
         STOPTIME:=CREATETIME;                                 <<01741>>10440000
      TOS:=MEASPROCXDSNUM;                                     <<01741>>10445000
      TOS:=PIN*CLASS15'SUB0SIZE+CP'JOBSESSIONNUM;              <<01741>>10450000
      TOS:=@PCBXMEASINFO;                                      <<01741>>10455000
      TOS:=2; <<MOVE JOB/SESSION NUM AND STOPWORD>>            <<01741>>10460000
      ASMB(MTDS 4);                                            <<01741>>10465000
      TOS:=MEASPROCXDSNUM;                                     <<01741>>10470000
      TOS:=PIN*CLASS15'SUB0SIZE+CP'CREATETIME;                 <<01741>>10475000
      TOS:=@STOPTIME;                                          <<01741>>10480000
      TOS:=2;                                                  <<01741>>10485000
      ASMB(MTDS 4); <<MOVE CREATETIME OR STOPTIME>>            <<01741>>10490000
      IF PROCESSTYPE = CIPROCESS OR SYSTEMPROCESS THEN         <<01741>>10495000
         BEGIN <<INIT WITH APPROPIATE NAME>>                   <<01741>>10500000
         TOS:=MEASPROCXDSNUM;                                  <<01741>>10505000
         TOS:=PIN*CLASS15'SUB0SIZE;                            <<01741>>10510000
         TOS:=IF PROCESSTYPE = CIPROCESS THEN @CINAME          <<01741>>10515000
                                         ELSE @SPNAME;         <<01741>>10520000
         TOS:=1;                                               <<01741>>10525000
         ASMB(MTDS 4);                                         <<01741>>10530000
         END;<<CI OR SP>>                                      <<01741>>10535000
      END; <<ACTIVE PROCESS>>                                  <<01741>>10540000
   END; <<WHILE LOOP>>                                         <<01741>>10545000
                                                               <<01741>>10550000
<<NOW INTIALIZE ALL SYS PROC CREATED BY PROGEN>>               <<01741>>10555000
                                                               <<01741>>10560000
WHILE (SYSPINSBASEX:=SYSPINSBASEX+1) <= SYSPINSLIMIT DO        <<01741>>10565000
   BEGIN                                                       <<01741>>10570000
   IF ABS(SYSPINSBASEX) <> 0 THEN                              <<01741>>10575000
      BEGIN <<FOUND A SYSTEM PROCESS ENTRY IN SYS GLOB CELL>>  <<01741>>10580000
      MOVE BNAMEBUF:=                                          <<01741>>10585000
             PROCNAMES((SYSPINSBASEX-SYSPINSBASE)*10),(10);    <<01741>>10590000
      TOS:=MEASPROCXDSNUM;                                     <<01741>>10595000
      TOS:=(ABS(SYSPINSBASEX)/PCBSIZE)*CLASS15'SUB0SIZE;       <<01741>>10600000
      TOS:=@NAMEBUF;                                           <<01741>>10605000
      TOS:=5;                                                  <<01741>>10610000
      ASMB(MTDS 4);                                            <<01741>>10615000
      END;                                                     <<01741>>10620000
   END;                                                        <<01741>>10625000
                                                               <<01741>>10630000
<<FINNALY, INITIALIZE ENTRY0 WITH CONTROL INFO>>               <<01741>>10635000
                                                               <<01741>>10640000
MOVE ENTRY0:=CLASS15'SUB0SIZE(0); <<ZERO>>                     <<01741>>10645000
ENTRY0(ENTRYSIZEX) := CLASS15'SUB0SIZE;                        <<01741>>10650000
ENTRY0(NUMENTRYSX) := MAXCONFIGPCB;                            <<01741>>10655000
DENTRY0(DCREATETIMEX) := CREATETIME;                           <<01741>>10660000
ENTRY0(BASEVERX) := BASEVER;                                   <<01741>>10665000
ENTRY0(BASEUPDX) := BASEUPD;                                   <<01741>>10670000
ENTRY0(BASEFIXX) := BASEFIX;                                   <<01741>>10675000
ENTRY0(ACTVERX)  := SYSGLOBVER;                                <<01741>>10680000
ENTRY0(ACTUPDX)  := SYSGLOBUPD;                                <<01741>>10685000
ENTRY0(ACTFIXX)  := SYSGLOBFIX;                                <<01741>>10690000
DENTRY0(MPEMEMX) := DOUBLE(LOGICAL(LINKMEMSTART));             <<01741>>10695000
DENTRY0(AVAILMEMX) := DOUBLE(NBANKS)*FULLBANKSIZE-             <<01741>>10700000
                      DENTRY0(MPEMEMX)+LASTBANKSIZE;           <<01741>>10705000
                                                               <<01741>>10710000
TOS:=MEASPROCXDSNUM;                                           <<01741>>10715000
TOS:=0; <<WORD 0 OF ENTRY0>>                                   <<01741>>10720000
TOS:=@ENTRY0;                                                  <<01741>>10725000
TOS:=CLASS15'SUB0SIZE;                                         <<01741>>10730000
ASMB(MTDS 4);                                                  <<01741>>10735000
                                                               <<01741>>10740000
<<INITIALIZATION IS COMPLETE>>                                 <<01741>>10745000
                                                               <<01741>>10750000
RELSIR(PCBSIR,MYSIR2);                                         <<01741>>10755000
RELSIR(LOADERSIR,MYSIR);                                       <<01741>>10760000
                                                               <<01741>>10765000
                                                               <<01741>>10770000
END;                                                           <<01741>>10775000
$PAGE "MPE IV MEASUREMENT INTERFACE (FORMATIOSTATSEG)"         <<01836>>10780000
PROCEDURE FORMATIOSTATSEG(IOSTATXDS'SIZE);                     <<02532>>10785000
  VALUE IOSTATXDS'SIZE;                                        <<02532>>10790000
  INTEGER IOSTATXDS'SIZE;                                      <<02532>>10795000
  OPTION UNCALLABLE;                                           <<04113>>10800000
                                                               <<01836>>10805000
COMMENT                                                        <<M7661>>10810000
***************************************************************<<M7661>>10815000
                                                               <<M7661>>10820000
THIS PROCEDURE IS USED TO INITIALIZE AND FORMAT ENTRY 0 OF THE <<M7661>>10825000
IOSTAT XDS AND IS CALLED ONLY FROM STARTSTATISTICS. WORD(0)    <<M7661>>10830000
POINTS TO THE NEXT AVAILABLE ENTRY AND IS INITIALIZED TO 1.    <<M7661>>10835000
WORD(1) IS THE NUMBER OF ENTRIES (INCLUDING ENTRY 0) WHICH IS  <<M7661>>10840000
CALCULATED AS:                                                 <<M7661>>10845000
                                                               <<M7661>>10850000
 IOSTATXDS'SIZE:= ( NUMBER OF IOQS + 3*(NUMBER OF DRQS) +1)/2  <<M7661>>10855000
                                                               <<M7661>>10860000
IF THIS NUMBER IS LESS THAN 255 THAN 255 IS USED, AND IF THIS  <<M7661>>10865000
NUMBER IS GREATER THAN 1024 THAN 1024 IS USED.                 <<M7661>>10870000
                                                               <<M7661>>10875000
WORD(2) AND WORD(3) ARE A DOUBLE WORD COUNTER INCREMENTED  BY  <<M7661>>10880000
THE PROCEUDRE STORE'IOQ EACH TIME A NEW ENTRY IS ADDED.        <<M7661>>10885000
WORD(8), WORD(9), WORD(10), AND WORD(11) CONTAIN THE STRING    <<M7661>>10890000
"I/O STAT" WHICH SERVES AS AN IDENTIFIER. WORD(14) AND WORD(15)<<M7661>>10895000
CONTAIN TIME RETURNED FROM THE TIMER INTRINSIC.                <<M7661>>10900000
                                                               <<M7661>>10905000
EACH ENTRY PLACED IN THE IOSTAT XDS WILL BE EITHER AN IOQ OR   <<M7661>>10910000
A DRQ.                                                         <<M7661>>10915000
                                                               <<M7661>>10920000
AN IOQ ENTRY WILL HAVE A 8 WORD BLOCK APPENDED TO PAD IT UP TO <<M7661>>10925000
20 WORDS WITH THE FOLLOWING FORMAT:                            <<M7661>>10930000
                                                               <<M7661>>10935000
     |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|         <<M7661>>10940000
%14  |             DST # OF IOQ TABLE                |         <<M7661>>10945000
     |-----------------------------------------------|         <<M7661>>10950000
%15  |             DB RELATIVE ADDRESS OF IOQ        |         <<M7661>>10955000
     |-----------------------------------------------|         <<M7661>>10960000
%16  |                   %177777                     |         <<M7661>>10965000
     |-----------------------------------------------|         <<M7661>>10970000
%17  |                   %177777                     |         <<M7661>>10975000
     |-----------------------------------------------|         <<M7661>>10980000
%20  |     IOQ RELEASE TIME FROM TIMER INTRINSIC     |         <<M7661>>10985000
     |-----------------------------------------------|         <<M7661>>10990000
%21  |     IOQ RELEASE TIME FROM TIMER INTRINSIC     |         <<M7661>>10995000
     |-----------------------------------------------|         <<M7661>>11000000
%22  |                    0                          |         <<M7661>>11005000
     |-----------------------------------------------|         <<M7661>>11010000
%23  |                    0                          |         <<M7661>>11015000
     |-----------------------------------------------|         <<M7661>>11020000
                                                               <<M7661>>11025000
                                                               <<M7661>>11030000
A DRQ ENTRY WILL HAVE A 3 WORD BLOCK APPENDED TO PAD IT UP TO  <<M7661>>11035000
20 WORDS WITH THE FOLLOWING FORMAT:                            <<M7661>>11040000
                                                               <<M7661>>11045000
     |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|         <<M7661>>11050000
%21  |     DRQ RELEASE TIME FROM TIMER INTRINSIC     |         <<M7661>>11055000
     |-----------------------------------------------|         <<M7661>>11060000
%22  |     DRQ RELEASE TIME FROM TIMER INTRINSIC     |         <<M7661>>11065000
     |-----------------------------------------------|         <<M7661>>11070000
%23  |                    0                          |         <<M7661>>11075000
     |-----------------------------------------------|         <<M7661>>11080000
                                                               <<M7661>>11085000
***************************************************************<<M7661>>11090000
;                                                                       11095000
                                                               <<01836>>11100000
 BEGIN                                                         <<01836>>11105000
   ARRAY  DATA(0:19); << allow 20 words per entry >>           <<M7661>>11110000
                                                               <<01836>>11115000
   MOVE  DATA:= 20(0);                                         <<M7661>>11120000
    DATA := 1;                                                 <<01836>>11125000
    DATA(1) := IOSTATXDS'SIZE; << SIZE OF XDS >>               <<01836>>11130000
    MOVE  DATA(8) := "I/O STAT";    << IDENTIFIER >>           <<01836>>11135000
    TOS := TIMER;                   << TIME >>                 <<01836>>11140000
    DATA(15) := TOS;                                           <<01836>>11145000
    DATA(14) := TOS;                                           <<01836>>11150000
                                                               <<01836>>11155000
    TOS := IOSTATXDSNUM;                                       <<01836>>11160000
    TOS := 0;                                                  <<01836>>11165000
    TOS := @DATA;                                              <<01836>>11170000
   TOS := 20;                                                           11175000
    ASMB(MTDS);                                                <<01836>>11180000
 END;                                                          <<01836>>11185000
PROCEDURE ENABLECLASS(CLASSNUMBER);                                     11190000
  VALUE   CLASSNUMBER;                                                  11195000
  LOGICAL CLASSNUMBER;                                                  11200000
  OPTION PRIVILEGED,UNCALLABLE;                                         11205000
                                                                        11210000
COMMENT                                                                 11215000
                                                                        11220000
THIS PROCEDURE WILL TURN ON CLASSMASK BITS AND INCREMENT                11225000
COUNTERS. THIS PROCEDURE IS CALLED FROM STARTSTATISTICS.                11230000
                                                                        11235000
INPUT PARAMETER:                                                        11240000
                                                                        11245000
   CLASSNUMBER IS THE NUMBER OF THE CLASS TO BE ENABLED.                11250000
                                                                        11255000
FIRST IT WILL TURN ON BIT 15 OF THE PROCCES'S PCLASSMASK, THEN          11260000
IT WILL TURN ON THE CORRESPONDING CLASS BIT. IF THE PROCESS DID         11265000
NOT ALREADY HAVE THAT CLASS ENABLED, THE ENABLED COUNTER FOR            11270000
THAT CLASS GETS INCREMENTED. FINALLY THE GLCLASSENABLEDMASK             11275000
IS SET.                                                                 11280000
;                                                                       11285000
                                                                        11290000
BEGIN                                                                   11295000
                                                                        11300000
LOGICAL ARRAY PCBXFIXED(*) = Q+0;                                       11305000
INTEGER X=X,                                                            11310000
        S0 = S-0,                                                       11315000
        PCLASSMASK'IDX;                                                 11320000
                                                                        11325000
GETPCLASSMASK;         <<OUT OF PCBXFIXED+%100)>>                       11330000
TOS:=PCLASSENABLEMASK;                                                  11335000
                                                                        11340000
X:=CLASSNUMBER;                                                         11345000
ASMB(TSBC 0,X);        <<SET MASK BIT FOR PROCESS>>                     11350000
                                                                        11355000
IF = THEN              <<NOT ALREADY ON FOR THIS PROCESS>>              11360000
  BEGIN                <<BUMP CLASSXENABLED COUNTER>>                   11365000
  CASE CLASSNUMBER OF                                                   11370000
    BEGIN                                                               11375000
    CLASS0COUNT  := CLASS0COUNT+1;                                      11380000
    CLASS1COUNT  := CLASS1COUNT+1;                                      11385000
    CLASS2COUNT  := CLASS2COUNT+1;                                      11390000
    CLASS3COUNT  := CLASS3COUNT+1;                                      11395000
    CLASS4COUNT  := CLASS4COUNT+1;                                      11400000
    CLASS5COUNT  := CLASS5COUNT+1;                                      11405000
    CLASS6COUNT  := CLASS6COUNT+1;                                      11410000
    CLASS7COUNT  := CLASS7COUNT+1;                                      11415000
    CLASS8COUNT  := CLASS8COUNT+1;                                      11420000
    CLASS9COUNT  := CLASS9COUNT+1;                                      11425000
    CLASS10COUNT := CLASS10COUNT+1;                                     11430000
    CLASS11COUNT := CLASS11COUNT+1;                                     11435000
    CLASS12COUNT := CLASS12COUNT+1;                                     11440000
    CLASS13COUNT := CLASS13COUNT+1;                                     11445000
    CLASS14COUNT := CLASS14COUNT+1;                                     11450000
    CLASS15COUNT := CLASS15COUNT+1;                            <<01741>>11455000
    END;                                                                11460000
  TOS:=GCLASSENABLEDMASK;                                               11465000
  X:=CLASSNUMBER;                                                       11470000
  ASMB(TSBC 0,X);                                                       11475000
  GCLASSENABLEDMASK:=TOS;                                               11480000
  END;                                                                  11485000
                                                                        11490000
PCLASSENABLEMASK:=TOS;                                                  11495000
                                                                        11500000
END;                                                                    11505000
$PAGE "MPE IV MEASUREMENT INTERFACE    (STARTSTATISTICS)"               11510000
                                                                        11515000
INTEGER PROCEDURE STARTSTATISTICS(CLASSMASK);                           11520000
  VALUE CLASSMASK;                                                      11525000
  LOGICAL CLASSMASK;                                                    11530000
  OPTION PRIVILEGED,UNCALLABLE;                                         11535000
                                                                        11540000
                                                                        11545000
COMMENT                                                                 11550000
*************************************************************           11555000
                                                                        11560000
This procedure is used to initiate statistics gathering                 11565000
for performance measurement and system debugging.                       11570000
                                                                        11575000
INPUT PARAMETERS:                                                       11580000
                                                                        11585000
      CLASSMASK: A bit mask of statistic classes to be enabled.         11590000
                                                                        11595000
RETURN VALUES:                                                          11600000
                                                                        11605000
      CC = CCL ==> COULD NOT OBTAIN DATASEGMENT                         11610000
      CC = CCE ==> OK                                                   11615000
      CC = CCG ==> NOT USED                                             11620000
                                                                        11625000
      STARTSTATISTICS = 0 ==> NO ERROR                                  11630000
                      = 1 ==> NO VMEM FOR DATA SEG                      11635000
                      = 2 ==> NO DST ENTRY AVAIL                        11640000
                      = 3 ==> COULD NOT LOCK DATA SEG                   11645000
                      = 4 ==> XDS SIZE IS TOO BIG              <<07397>>11650000
                                                                        11655000
OPERATION:                                                              11660000
                                                                        11665000
The first thing STARTSTATISTICS does is to get the MEASSIR,             11670000
this will avoid the possibility of two users updating sys glob          11675000
cells at the same time. If sys global cell GCLASSENABLEDMASK            11680000
equal to zero then it will obtain, lock, freeze, and format             11685000
the data segment to be used for statistics gathering. It will           11690000
then turn on corresponding bits in both the sys global cell,            11695000
and the proceses PCLASSENABLEDMASK (PXFIXED(%100)).                     11700000
                                                                        11705000
*************************************************************           11710000
;                                                                       11715000
                                                                        11720000
BEGIN                                                                   11725000
                                                                        11730000
LOGICAL BITWORD,           <<LOOP VARIABLE FOR SETTING MASKS>>          11735000
        BASE,              <<BASE OF STATS XDS>>                        11740000
        DSTBASE,                                                        11745000
        MYSIR,             <<USED AS 2ND PARM FOR RELSIR>>              11750000
        SAVEX;                                                          11755000
INTEGER DISC:=0,           <<PARM FOR FINDDEVICES,TYPE 0=DISC>>         11760000
        I,                 <<UTILITY>>                                  11765000
        X=X,                                                            11770000
        TYPE,            <<LOOP VARIABLE, NUM OF TYPES>>                11775000
        MEASDSTNUM,      <<LOCAL COPY OF DSTNUM>>                       11780000
        MEASSTATXDS'SIZE,<<SIZE TO CREATE XDS WITH>>                    11785000
        MEASPROCXDS'SIZE, <<SIZE TO CREATE PROC XDS>>          <<01741>>11790000
        IOSTATXDS'SIZE,  <<SIZE OF I/O XDS>>                   <<02532>>11795000
        ERROR:=0,        <<LOCAL ERROR VALUE>>                          11800000
        STATUS=Q-1,      <<STATUS REGISTER  >>                          11805000
        SAVECC:=CCE;     <<LOCAL USE OF COND CODE>>                     11810000
EQUATE MAXLDEV = LDEVTABSIZE - 1;                              <<07187>>11815000
INTEGER ARRAY LDEV'NO(0:MAXLDEV),    <<PARM FOR FINDEVICE>>    <<07187>>11820000
              TOTAL'DEVICES(0:20),  <<0:1 = TOTAL # DEV TYPES>>         11825000
                                    <<1:1 = # OF DISCS>>                11830000
                                    <<2:1 = # OF LP'S >>                11835000
                                    <<3:1 = # OF TAPES>>                11840000
                                    <<4:1 = # OF TERM >>                11845000
                                    <<4:1 = # OF TERMS>>                11850000
                                                                        11855000
                                                                        11860000
              LDEVTAB(0:MAXLDEV),   <<LDEV TO ENTRY MAP>>      <<07187>>11865000
              ENTCNTTAB(0:10);      <<COUNTER FOR LDEVS>>               11870000
                                                                        11875000
EQUATE DSTBASEPTR=2,        <<ABS LOC OF DST BASE>>                     11880000
       VMEMERR=1,           <<NO VMEM FOR XDS>>                         11885000
       DSTENTERR=2,         <<NO AVAIL DST ENT>>                        11890000
       LOCKERR=3;           <<UNABLE TO LOCK XDS>>                      11895000
EQUATE DSTSIZE'ERR = 4;                                        <<07397>>11900000
                                                                        11905000
                                                                        11910000
MOVE TOTAL'DEVICES:=21(0);    <<INITIALIZE>>                            11915000
MOVE ENTCNTTAB:=10(0);                                                  11920000
MOVE LDEVTAB := LDEVTABSIZE(0);                                <<07187>>11925000
TRAPOFF;                    << TO PREVENT INTEGER OVER FLOW >> <<04497>>11930000
MYSIR:=GETSIR(MEASSIR);    <<INSURE ONLY ONE ACCESS AT A TIME>>         11935000
                                                               <<01741>>11940000
<<***********************************************************>><<01741>>11945000
<<  ACQUISITION OF GLOBAL STATISTICS XDS                     >><<01741>>11950000
<<***********************************************************>><<01741>>11955000
IF NOT (GLOBALSTATSENBLD) AND GLOBALSTATREQ THEN               <<01741>>11960000
  BEGIN <<GLOBAL STAT GATHERING NOT ENABLED>>                  <<01741>>11965000
  FOR TYPE:=1 UNTIL NUMDEVTYPES DO <<# OF DEV TYPES MONITORED>>         11970000
    BEGIN                                                               11975000
    FINDDEVICES(TYPE,LDEV'NO);  <<FIND OUT NO OF DEVS CONFIG>>          11980000
    FOR I := 1 UNTIL LDEV'NO DO                                         11985000
       BEGIN <<BUILD ENTRY IN LDEVTAB>>                                 11990000
       ENTCNTTAB(TYPE):=ENTCNTTAB(TYPE)+1;                              11995000
       LDEVTAB(LDEV'NO(I)).CFIELD:=0;                                   12000000
       LDEVTAB(LDEV'NO(I)).SFIELD:=TYPE;                                12005000
       LDEVTAB(LDEV'NO(I)).EFIELD:=ENTCNTTAB(TYPE);                     12010000
       END;                                                             12015000
    TOTAL'DEVICES(TYPE):=LDEV'NO;   <<# DEVS OF THIS TYPE>>             12020000
    END;                                                                12025000
  TOTAL'DEVICES(0) := NUMDEVTYPES; <<# OF DEV TYPES MONITORED>>         12030000
  MEASSTATXDS'SIZE:=LDEVTABSIZE+CLASSCOUNT+                             12035000
                    CLASS0SIZE+CLASS1SIZE;                              12040000
  MEASDSTNUM := GETDATASEG(MEASSTATXDS'SIZE,MEASSTATXDS'SIZE);          12045000
  IF = THEN                                                             12050000
    BEGIN <<GOT THE DATA SEG>>                                          12055000
    MEASSTATXDS'NUM := MEASDSTNUM;                                      12060000
    LOCKSEG(MEASSTATXDS'NUM,%3,0);                                      12065000
    IF = THEN                                                           12070000
      BEGIN <<LOCKED THE DATA SEGMENT>>                                 12075000
      FREEZE(MEASSTATXDS'NUM,1,0);    <<FREEZE THE SEGMENT >>           12080000
      <<DETERMINE THE BANK NUMBER, AND ADDRESS OF THE XDS>>             12085000
      DSTBASE:=ABS(DSTBASEPTR);    <<DETERMINE BASE OF DST>>            12090000
      BASE:=DSTBASE+LOGICAL(MEASSTATXDS'NUM)*4; <<BASE OF XDS>>         12095000
       MEASSTATXDSBANK:=ABS(BASE+2);                           <<04313>>12100000
      MEASSTATXDSBASE:=ABS(BASE+3);                                     12105000
      FORMATSEG(MEASSTATXDS'SIZE,TOTAL'DEVICES,LDEVTAB);                12110000
      END   <<SUCCESFULL ACQUISITION OF DATA SEGMENT>>                  12115000
    ELSE ERROR:=LOCKERR;  <<UNABLE TO LOCK DATA SEGMENT>>               12120000
    END                                                                 12125000
  ELSE                                                                  12130000
    BEGIN <<UNABLE TO GET DATASEG>>                                     12135000
    IF < THEN ERROR:=DSTENTERR                                          12140000
    ELSE ERROR:=VMEMERR;                                                12145000
    END;                                                                12150000
  END; <<ACQUISITION OF DATA SEGMENT>>                                  12155000
                                                               <<01741>>12160000
<<***********************************************************>><<01741>>12165000
<<  ACQUISITION OF PROCESS LEVEL INSTRUMENTATION XDS         >><<01741>>12170000
<<***********************************************************>><<01741>>12175000
                                                                        12180000
IF NOT (PROCSTATSENBLD) AND PROCSTATREQ THEN                   <<01741>>12185000
   BEGIN <<PROCESS STAT GATHERING NOT ENABLED>>                <<01741>>12190000
   MEASPROCXDS'SIZE := CLASS15SIZE;                            <<01741>>12195000
                                                                        12200000
   IF 0 <= MEASPROCXDS'SIZE <= (MAX'ENT'SIZE*MAX'PIN'NUM) THEN <<07397>>12205000
   BEGIN       << XDS SIZE IS IN THE ACCEPTABLE SIZE >>        <<07068>>12210000
   MEASDSTNUM := GETDATASEG(MEASPROCXDS'SIZE,MEASPROCXDS'SIZE);<<01741>>12215000
   IF = THEN                                                   <<01741>>12220000
      BEGIN << GOT THE DATA SEG >>                             <<01741>>12225000
      MEASPROCXDSNUM := MEASDSTNUM;                            <<01741>>12230000
      LOCKSEG(MEASPROCXDSNUM,3,0);                             <<01741>>12235000
      IF = THEN                                                <<01741>>12240000
         BEGIN                                                 <<01741>>12245000
         FREEZE(MEASPROCXDSNUM,1,0);                           <<01741>>12250000
         <<DETERMINE THE BANK NUMBER AND ADDRESS OF XDS>>      <<01741>>12255000
         DSTBASE:=ABS(DSTBASEPTR);                             <<01741>>12260000
         BASE:=DSTBASE+LOGICAL(MEASPROCXDSNUM)*4;              <<01741>>12265000
          MEASPROCXDSBANK:=ABS(BASE+2);                        <<04313>>12270000
         MEASPROCXDSBASE:=ABS(BASE+3);                         <<01741>>12275000
         FORMATPROCSEG(MEASPROCXDS'SIZE);                      <<01741>>12280000
         END                                                   <<01741>>12285000
      ELSE ERROR:=LOCKERR;                                     <<01741>>12290000
      END                                                      <<01741>>12295000
   ELSE                                                        <<01741>>12300000
      BEGIN <<UNABLE TO GET DATA SEG>>                         <<01741>>12305000
      IF < THEN ERROR:=DSTENTERR                               <<01741>>12310000
      ELSE ERROR:=VMEMERR;                                     <<01741>>12315000
      END;                                                     <<01741>>12320000
   END                                                         <<07068>>12325000
   ELSE        << XDS SIZE IS NOT IN ACCEPTABLE SIZE >>        <<07068>>12330000
   ERROR := DSTSIZE'ERR;                                       <<07397>>12335000
   END; <<ACQUISITION OF PROCESS XDS>>                         <<01741>>12340000
                                                               <<01741>>12345000
                                                               <<01836>>12350000
<<***********************************************************>><<01836>>12355000
<<  ACQUISITION OF I/O STATISTIC INSTRUMENTATION XDS         >><<01836>>12360000
<<***********************************************************>><<01836>>12365000
                                                               <<01836>>12370000
 IF  NOT (IOSTATSENBLD) AND IOSTATREQ  THEN                    <<01836>>12375000
 BEGIN           << I/O STATISTIC GATHERING NOT ENABLED >>     <<01836>>12380000
    IOSTATXDS'SIZE :=                                          <<01836>>12385000
       ((IOQTBPTR(0) + DISCREQTBPTR(0)) *3 + 1)/2;             <<07068>>12390000
    IF  IOSTATXDS'SIZE < 255  THEN  IOSTATXDS'SIZE := 255;     <<01836>>12395000
   IF  IOSTATXDS'SIZE > 1024 THEN IOSTATXDS'SIZE:= 1024;       <<M7661>>12400000
  I:= (IOSTATXDS'SIZE+1) * 20; << for drq plus extra space >>  <<M7661>>12405000
    MEASDSTNUM := GETDATASEG(I, I);                            <<01836>>12410000
    IF  =  THEN                                                <<01836>>12415000
    BEGIN                                                      <<01836>>12420000
       LOCKSEG(MEASDSTNUM, 3, 0);                              <<01836>>12425000
       IF  =  THEN                                             <<01836>>12430000
       BEGIN                                                   <<01836>>12435000
          FREEZE(MEASDSTNUM, 1, 0);                            <<01836>>12440000
          IOSTATXDSNUM := MEASDSTNUM;                          <<01836>>12445000
          DSTBASE := ABS(DSTBASEPTR);                          <<01836>>12450000
          BASE := DSTBASE + LOGICAL(MEASDSTNUM)&LSL(2);        <<01836>>12455000
          IOSTATXDSBANK := ABS(BASE+2);                        <<01836>>12460000
          IOSTATXDSBASE := ABS(BASE+3);                        <<01836>>12465000
          FORMATIOSTATSEG(IOSTATXDS'SIZE);                     <<02532>>12470000
       END  ELSE  ERROR := LOCKERR;                            <<01836>>12475000
    END  ELSE                                                  <<01836>>12480000
       ERROR :=  IF <  THEN  DSTENTERR  << NO DST SEG >>       <<01836>>12485000
                 ELSE  VMEMERR;                                <<01836>>12490000
 END;           << ACQUISITION OF I/O STAT XDS >>              <<01836>>12495000
                                                               <<01836>>12500000
IF ERROR = 0 THEN                                                       12505000
  BEGIN       <<SET GCLASSENABLEDMASK AND PCLASSENABLED MASK>>          12510000
  SAVEX:=-1;                   <<USED TO INITIALIZE X REG>>             12515000
  BITWORD:=CLASSMASK;          <<LOOP VARIABLE>>                        12520000
  WHILE BITWORD <> 0 DO                                                 12525000
    BEGIN                                                               12530000
    TOS:=BITWORD;                                                       12535000
    X:=SAVEX;                                                           12540000
    ASMB(SCAN,X);                                                       12545000
    SAVEX:=X;                <<FOR USE IN NEXT SCAN>>                   12550000
    BITWORD:=TOS;            <<SCAN BITSHIFTS LEFT UNTIL 0>>            12555000
    ENABLECLASS(SAVEX);      <<TURN ON GLOBAL AND PROC MASKS>>          12560000
    END;                                                                12565000
  END                                                                   12570000
ELSE                                                                    12575000
  SAVECC:=CCL;                                                          12580000
RELSIR(MEASSIR,MYSIR);                                                  12585000
STARTSTATISTICS:=ERROR;                                                 12590000
CC:=SAVECC;                                                             12595000
END;                                                                    12600000
                                                                        12605000
$PAGE "MPE IV MEASUREMENT INTERFACE      GETSTATISTICS"                 12610000
INTEGER PROCEDURE GETSTATISTICS(CLASS,SUBCLASS,STARTINGITEM,            12615000
                                 WORDCOUNT,WHERE);                      12620000
  VALUE CLASS,SUBCLASS,STARTINGITEM,WORDCOUNT;                          12625000
  INTEGER CLASS,SUBCLASS,STARTINGITEM,WORDCOUNT;                        12630000
  INTEGER ARRAY WHERE;                                                  12635000
  OPTION PRIVILEGED,UNCALLABLE;                                         12640000
                                                                        12645000
                                                                        12650000
COMMENT                                                                 12655000
*************************************************************           12660000
                                                                        12665000
GETSTATISTICS WILL RETREIVE MEASUREMENT DATA FROM THE XDS               12670000
UPDATED BY THE MPE'S STATISTICS UPDATING MECHANISM.                     12675000
                                                                        12680000
         INPUT PARAMETERS                                               12685000
                                                                        12690000
         CLASS,          CLASS NUMBER OF DESIRED STATS                  12695000
         SUBCLASS,       SUBCLASS NUMBER OF CLASS                       12700000
         STARTINGITEM,   BEGINING ITEM NUMBER OF SUBCLASS               12705000
         WORDCOUNT,      LENGTH OF TRANSFER                             12710000
                                                                        12715000
    OUTPUT PARAMETER:                                                   12720000
                                                                        12725000
         WHERE,          TARGET ARRAY                                   12730000
                                                                        12735000
RETURN VALUES:                                                          12740000
                                                                        12745000
       CC = CCL ==> BAD PARAMETER                                       12750000
       CC = CCE ==> OK                                                  12755000
       CC = CCG ==> NOT USED                                            12760000
                                                                        12765000
       GETSTATISTICS = 0 ==>OK                                          12770000
                     = 1 ==> NOT ENABLED                                12775000
                     = 2 ==> ARRAY OUT OF BOUNDS                        12780000
                     = 3 ==> BAD WORDCOUNT PARM                         12785000
                     = 4 ==> BAD STARTINGITEM PARM                      12790000
                     = 5 ==> BAD SUBCLASS PARM                          12795000
                     = 6 ==> BAD CLASS PARM                             12800000
                                                                        12805000
OPERATION:                                                              12810000
                                                                        12815000
GETSTATISTICS WILL FIRST USE ABSOLUTE ADDRESSING TO COMPUTE THE         12820000
BASE OF THE REQUESTED SUBCLASS (ENTRY0) AND RETREIVE THE ENTRY          12825000
COUNT FROM ENTRY0. THIS IS DONE BEFORE PARAMETER CHECKING BE-           12830000
CAUSE NUMBER OF ENTRIES IS USED IN PARAMETER CHECKING.                  12835000
SUBROUTINES ARE USED TO DO RANGE CHECKING ON INCOMING PARMS,            12840000
IF NO ERRORS ARE ENCOUNTERED THEN THE MFDS INSTRUCTION IS USED          12845000
TO TRNASFER THE DATA TO THE TARGET ARRAY.                               12850000
*************************************************************           12855000
;                                                                       12860000
                                                                        12865000
                                                                        12870000
BEGIN                                                                   12875000
                                                                        12880000
EQUATE  NOTENBLD       = 1,  <<STATISTICS GATH NOT ENBLD>>              12885000
        BOUNDS'ERROR   = 2,  <<ARRAY OUT OF BOUNDS   >>                 12890000
        WORDCNT'ERROR  = 3,  <<WORDCOUNT OUT OF RANGE>>                 12895000
        STARTITEM'ERROR  = 4,  <<STARTINGITEM OUT OF RANGE>>            12900000
        SUBCLASS'ERROR = 5,  <<SUBCLASS OUT OF RANGE>>                  12905000
        CLASS'ERROR    = 6;  <<CLASS OUT OF RANGE>>                     12910000
                                                                        12915000
INTEGER ERROR:=NOTENBLD,                                                12920000
        SAVECC:=CCE,         <<TEMP COND CODE>>                         12925000
        STATUS=Q-1;          <<STATUS REGISTER>>                        12930000
                                                                        12935000
INTEGER ARRAY C0'SUBSIZES(*) = PB:= CLASS0'SUB0SIZE,                    12940000
                                    CLASS0'SUB1SIZE,                    12945000
                                    CLASS0'SUB2SIZE,                    12950000
                                    CLASS0'SUB3SIZE;                    12955000
                                                                        12960000
INTEGER ARRAY C1'SUBSIZES(*) = PB:= CLASS1'SUB0SIZE,                    12965000
                                    CLASS1'SUB1SIZE,                    12970000
                                    CLASS1'SUB2SIZE,                    12975000
                                    CLASS1'SUB3SIZE,                    12980000
                                    CLASS1'SUB4SIZE,                    12985000
                                    CLASS1'SUB5SIZE;                    12990000
                                                                        12995000
INTEGER CLASSBASE,       <<OFFSET TO REQUESTED CLASS>>                  13000000
        SUBBASE,         <<SEG REL OFFSET TO REQ SUBCLASS>>             13005000
        ACTUAL'ENTRIES,  <<NUM ENTRIES LESS ENTRY 0>>                   13010000
        WHERE'ADDR=Q-4,   <<USED TO DETERMINE IF MAX POSSIBLE>>         13015000
        LASTADDR,                                                       13020000
        Q,                <<ARRAY SIZE WILL FIT WITHIN THE  >>          13025000
        DL,               <<USERS STACK                     >>          13030000
        X=X;              <<X REG>>                                     13035000
                                                                        13040000
LOGICAL ARRAY MEASSTAT'XDS(*)=DB+0;                                     13045000
                                                                        13050000
DEFINE CLASSBASE'IDX   = (CLASS+1)#,  <<OFFSET TO CLASS>>               13055000
       SUBBASE'IDX     = (SUBCLASS+1)#, <<OFFSET TO SUBCLASS>>          13060000
       ITEM'NUM        = (STARTINGITEM+3)#;<<GET PAST ENTRY 0>>         13065000
                                                                        13070000
LOGICAL FGET:=FALSE;                                                    13075000
                                                                        13080000
ENTRY FGETSTATISTICS;        <<WILL BYPASS PARM CHECKING>>              13085000
                                                                        13090000
<<***************SUBROUTINES*********************>>                     13095000
                                                                        13100000
LOGICAL SUBROUTINE GOODSUBCLASS;                                        13105000
BEGIN  <<CHECK FOR VALID SUBCLASS>>                                     13110000
GOODSUBCLASS:=TRUE;                                                     13115000
CASE CLASS OF                                                           13120000
   BEGIN                                                                13125000
   <<CLASS0>>                                                           13130000
   IF SUBCLASS < 0 OR SUBCLASS >= CLASS0'SUBCLASSCNT THEN               13135000
      GOODSUBCLASS:=FALSE;                                              13140000
   <<CLASS1>>                                                           13145000
   IF SUBCLASS < 0 OR SUBCLASS >= CLASS1'SUBCLASSCNT THEN               13150000
      GOODSUBCLASS:=FALSE;                                              13155000
   END; <<CASE>>                                                        13160000
END; <<GOODSUBCLASS>>                                                   13165000
                                                                        13170000
                                                                        13175000
LOGICAL SUBROUTINE GOODWORDCNT;                                         13180000
BEGIN << CHECK FOR VALID WORDCOUNT>>                                    13185000
GOODWORDCNT:=TRUE;                                                      13190000
CASE CLASS OF                                                           13195000
   BEGIN <<CLASS0>>                                                     13200000
   IF WORDCOUNT < 0 OR                                                  13205000
   WORDCOUNT + STARTINGITEM >                                           13210000
   C0'SUBSIZES(SUBCLASS)*ACTUAL'ENTRIES THEN                            13215000
      GOODWORDCNT:=FALSE;                                               13220000
   <<CLASS1>>                                                           13225000
   IF WORDCOUNT < 0 OR                                                  13230000
   WORDCOUNT + STARTINGITEM >                                           13235000
   C1'SUBSIZES(SUBCLASS)*ACTUAL'ENTRIES THEN                            13240000
      GOODWORDCNT:=FALSE;                                               13245000
   END; <<CASE>>                                                        13250000
END;<<GOODWORDCNT>>                                                     13255000
                                                                        13260000
                                                                        13265000
LOGICAL SUBROUTINE GOODSTARTITEM;                                       13270000
BEGIN <<CHECK FOR GOOD STARTINGITEM>>                                   13275000
GOODSTARTITEM:=TRUE;                                                    13280000
IF STARTINGITEM < -3 THEN <<DONT ALLOW ACCESS ABOVE ENTRY 0>>           13285000
   GOODSTARTITEM:=FALSE                                                 13290000
ELSE                                                                    13295000
   CASE CLASS OF                                                        13300000
     BEGIN                                                              13305000
     <<CLASS0>>                                                         13310000
     IF STARTINGITEM>=C0'SUBSIZES(SUBCLASS)*ACTUAL'ENTRIES THEN         13315000
        GOODSTARTITEM:=FALSE;                                           13320000
     <<CLASS1>>                                                         13325000
     IF STARTINGITEM>=C1'SUBSIZES(SUBCLASS)*ACTUAL'ENTRIES THEN         13330000
        GOODSTARTITEM:=FALSE;                                           13335000
     END; <<CASE>>                                                      13340000
END; <<GOODSTARTITEM>>                                                  13345000
                                                                        13350000
                                                                        13355000
LOGICAL SUBROUTINE GOODCLASS;                                           13360000
BEGIN << CHECK FOR VALID CLASS>>                                        13365000
GOODCLASS:=TRUE;                                                        13370000
IF CLASS < 0 OR CLASS >= CLASSCOUNT THEN                                13375000
   GOODCLASS:=FALSE;                                                    13380000
END; <<GOODCLASS>>                                                      13385000
                                                                        13390000
<<******************END OF SUBROUTINES******************>>              13395000
                                                                        13400000
GOTO MAIN;                                                              13405000
                                                                        13410000
FGETSTATISTICS:                                                         13415000
                                                                        13420000
FGET:=TRUE;                                                             13425000
                                                                        13430000
MAIN:                                                                   13435000
                                                                        13440000
  TRAPOFF;        << TO PREVENT INTEGER OVER FLOW >>           <<04497>>13445000
  PDISABLE;     <<MAKE SURE NO ONE CHANGES GATHERING STATUS>>           13450000
                                                                        13455000
TOS:=GCLASSENABLEDMASK;   <<IS CURRENTLY ENABLED           >>           13460000
X:=CLASS;                 <<CHECK TO SEE IF REQUESTED CLASS>>           13465000
ASMB(TBC 0,X);                                                          13470000
IF <> THEN                                                              13475000
  BEGIN                   <<CLASS WAS ENABLED>>                         13480000
                                                                        13485000
  ERROR:=0;                                                             13490000
                                                                        13495000
  TOS:=MEASSTATXDSBANK;                                                 13500000
  TOS:=MEASSTATXDSBASE+LDEVTABSIZE;                                     13505000
  TOS:=TOS+CLASSBASE'IDX;       <<ABS ADDR OF CLASSBASE PTR>>           13510000
  ASMB(LSEA);                   <<PULL OUT OFFSET TO CLASS >>           13515000
  CLASSBASE:=TOS;                                                       13520000
                                                                        13525000
  <<NOW GET SEGRELOFF FOR SUBCLASS>>                                    13530000
                                                                        13535000
  TOS:=CLASSBASE-CLASSBASE'IDX+SUBBASE'IDX; <<ADD SEGREL OFF>>          13540000
  ASMB(LADD;LSEA);       <<ADD TO ABS ADDR OF CLASSBASE PTR>>           13545000
  SUBBASE:=TOS+CLASSBASE;  <<STATS BASE REL OFFSET>>                    13550000
                                                                        13555000
  <<FINALLY PULL OUT NUMBER OF ENTRIES IN SUBCLASS>>                    13560000
                                                                        13565000
  TOS:=SUBBASE-CLASSBASE-SUBBASE'IDX;                                   13570000
  ASMB(LADD);                                                           13575000
  ASMB(LSEA);                                                           13580000
  ACTUAL'ENTRIES:=TOS-1;   <<SUB 1 FOR ENTRY 0>>                        13585000
  DDEL;                                                                 13590000
                                                                        13595000
  IF NOT FGET THEN                                                      13600000
    BEGIN               <<PARAMETER CHECKING>>                          13605000
                                                                        13610000
    IF NOT GOODCLASS THEN                                               13615000
       ERROR := CLASS'ERROR                                             13620000
    ELSE                                                                13625000
       IF NOT GOODSUBCLASS THEN                                         13630000
          ERROR := SUBCLASS'ERROR                                       13635000
       ELSE                                                             13640000
          IF NOT GOODSTARTITEM THEN                                     13645000
             ERROR := STARTITEM'ERROR                                   13650000
          ELSE                                                          13655000
             IF NOT GOODWORDCNT THEN                                    13660000
                ERROR := WORDCNT'ERROR;                                 13665000
                                                                        13670000
  <<CHECK TO SEE IF MAX POSSIBLE ARRAY SIZE WILL FIT IN STACK>>         13675000
                                                                        13680000
      TRAPOFF; <<PREVENT INTEGER OVERFLOW>>                    <<01836>>13685000
    LASTADDR:=WHERE'ADDR+WORDCOUNT;                                     13690000
    PUSH(DL,Q);                                                         13695000
    DL:=TOS;                                                            13700000
    Q:=TOS-10;   <<-10 SO USER CANT CLOBBER PARMS OR MARKER>>           13705000
    IF NOT (DL<=LASTADDR<=Q) THEN                                       13710000
      ERROR:=BOUNDS'ERROR;                                              13715000
    END;   <<PARAMETER CHECKING>>                                       13720000
  END;     <<CLASS WAS ENABLED>>                                        13725000
                                                                        13730000
IF ERROR = 0 THEN                                                       13735000
   BEGIN                                                                13740000
   TOS:=@WHERE;                                                         13745000
   TOS:=MEASSTATXDS'NUM;                                                13750000
   TOS:=SUBBASE+ITEM'NUM+LDEVTABSIZE;                                   13755000
   TOS:=WORDCOUNT;                                                      13760000
   ASMB(MFDS 4);                                                        13765000
   END                                                                  13770000
                                                                        13775000
ELSE                                                                    13780000
                                                                        13785000
   SAVECC:=CCL;                                                         13790000
                                                                        13795000
PENABLE;   <<ALL DONE>>                                                 13800000
                                                                        13805000
GETSTATISTICS:=ERROR;                                                   13810000
CC:=SAVECC;                                                             13815000
END;                                                                    13820000
$PAGE    "          SHARED CLOCK INTERFACE - USER'S GUIDE "             13825000
 << ***********************************************************         13830000
                                                                        13835000
                    GUIDE TO USE THE CLOCK INTERFACE                    13840000
                                                                        13845000
                                                                        13850000
    ****************************   IMPORTANT   *********************    13855000
    THIS INTERFACE IS NOT FOR THE CASUAL USER.  IT IS PRIVILEGED AND    13860000
    UNCALLABLE FOR GOOD REASON.  THE USER MUST KNOW ENOUGH ABOUT MPE    13865000
    AND THE HP3000 TO WRITE AN EXTERNAL INTERRUPT HANDLER AND           13870000
    DEBUGGING, OF COURSE, MUST BE DONE IN A SUITABLE ENVIROMENT AS      13875000
    THERE WILL UNDOUBTEDLY BE A FEW SYSTEM FAILURES.                    13880000
    ****************************************************************    13885000
                                                                        13890000
I.    Introduction                                                      13895000
                                                                        13900000
Collecting measurement data via the interrupt driven method is one way  13905000
to collect data about a computer system.  Although it does not yield as 13910000
accurate data as the event driven method, flexibility and low overhead  13915000
are its main advantages.  However, due to the difficuity in installing  13920000
an extra clock in the system, there were few tools available to the Lab 13925000
and field that used clock interrupts as a source of external interrupts.13930000
One of them, SAMPLER, used an extra clock and hence its use was limited 13935000
to the Lab and a few field offices.  Additionally, spare clocks cannot  13940000
be installed in HPIB systems.                                           13945000
                                                                        13950000
To overcome this difficulty and enhance applicability in this area, an  13955000
MPE interface is available so that one can "share" the system clock with13960000
MPE in an easy and low overhead fashion.  For details of the interface, 13965000
please refer to the mini-project document.  In this user's guide, we    13970000
shall restrict our attention to the data collection procedure that is   13975000
supplied by the user.                                                   13980000
                                                                        13985000
II.   Brief Summary of the Clock Interface                              13990000
                                                                        13995000
If no user is "sharing" the clock, it runs at the normal interrupt rate 14000000
of 100 ms.  When a user issues a request through GETCLOCK, one of the   14005000
parameters is the requested interrupt interval and another is the       14010000
program label of the data collection procedure.  After checking that no 14015000
other user is currently using the clock, GETCLOCK then obtains a        14020000
sharable CST entry to be used by the data collection procedure and then 14025000
locks and freezes its segment in memory.  Also it sets the clock        14030000
interrupt rate according to the user's request and calls the data       14035000
collection procedure at the specified interval.  After the data         14040000
collection is done, the user calls GIVECLOCK to release the data        14045000
collection procedure and the clock.  For details of these procedures and14050000
the meaning of the condition and error codes returned, please refer to  14055000
Appendix B of this document.                                            14060000
                                                                        14065000
III.  Data collection procedure                                         14070000
                                                                        14075000
It is paramont to have an efficient data collection procedure.  Since it14080000
operates on the ICS, the time spent in the procedure should be keep as  14085000
short as possible, preferably within 1 ms.  Also, since the size of the 14090000
ICS is usually smaller than most user stacks and non-expandable, extra  14095000
data segments should be used for data storage and the instructions MFDS 14100000
and MTDS should be used to move only the necessary data from and to the 14105000
extra data segment.                                                     14110000
                                                                        14115000
When entering the data collection procedure, DB is set in Bank 0 of the 14120000
memory and because code is executed on the ICS, the user should be      14125000
extremely careful when using DB-relative address so that it is done in a14130000
proper way.  Before leaving the procedure, make sure to set DB back to  14135000
the value it had entering the procedure.                                14140000
                                                                        14145000
When the procedure is entered, interrupts are enabled.  If the data the 14150000
user collects might be changed, he should disable interrupts during that14155000
period of time.  However, he should keep this time as short as possible.14160000
                                                                        14165000
The data collection procedure can reside in, and be compiled along with,14170000
the user's program.  It must be in a segment by itself and it must not  14175000
call any procedures of non-resident segments.                           14180000
                                                                        14185000
Since the data collection procedure is called by the procedure "TICK" of14190000
HARDRES.  It is considered to be a "pseudo" interrupt receiver, hence an14195000
"EXIT" should be used when leaving the data collection procedure.       14200000
{NEVER} uses "IXIT" for it will crash the system.                       14205000
                                                                        14210000
IV.   Data Storage                                                      14215000
                                                                        14220000
      It is advisable to use extra data segments to store the data.     14225000
      However, several important precautions have to be mentioned:      14230000
                                                                        14235000
      1.  The extra data segments should be locked and frozen in memory 14240000
          before data collection begins.  This can be done easily by    14245000
          calling the system intrinsic GETDSEG or system procedure      14250000
          GETDATASEG and using the returned DST number as a input value 14255000
          to GETCLOCK.  It then stores the DST numbers of those XDS in  14260000
          words %71 and %72 of MEASINFOTAB.  It will also lock and      14265000
          freeze those XDS's.  At process termination time MORGUE will  14270000
          call GIVECLOCK if the user failed to do so and dispose of the 14275000
          XDS's.                                                        14280000
                                                                        14285000
      2.  The initialization of the extra data segment should be done   14290000
          before data collection.  This will simplify the coding of the 14295000
          data collection procedure as well as minimize the time spent  14300000
          in the data collection procedure.                             14305000
                                                                        14310000
      The user can call GETCLOCK and enter the parameter INTRATE=0.     14315000
      This will perform all the functions of GETCLOCK except set the    14320000
      clock interrupt rate and call the user data collection procedure. 14325000
      Hence it will enable the user to initialize his data segments     14330000
      before actual data collection begins.                             14335000
                                                                        14340000
V.    Caveats                                                           14345000
                                                                        14350000
The Shared Clock Interface is a useful tool in the Lab as well as in the14355000
field.  However, potential destruction of the integrity of the system   14360000
exits if one does not use great care.  Here is a list of some of the    14365000
dangrous areas and some of the possible solutions:                      14370000
                                                                        14375000
      A.  NEVER modify absolute words %17 or %21 in the low memory and  14380000
          words %70 to %77 in the MEASINFOTAB directly.  Use only       14385000
          GETCLOCK and GIVECLOCK to set and reset these words and the   14390000
          system clock.                                                 14395000
                                                                        14400000
      B.  When entering the data collection procedure, always set the DB14405000
          register to an appropriate value even if you think you never  14410000
          use the DB register.  Reset the DB register before exiting.   14415000
          Never assume that DB is pointing at certain location.  NEVER  14420000
          USE PROCEDURE EXCHANGEDB, USE THE INSTRUCTION XCHD INSTEAD!   14425000
                                                                        14430000
      C.  Since the data collection procedure runs on the ICS, no       14435000
          boundary checking is done on behalf of the user.  Use extra   14440000
          data segments for data storage.  Never use any storage in the 14445000
          user process stack.                                           14450000
                                                                        14455000
      D.  Too frequent clock interrupts may impose a large amount of    14460000
          overhead on the system and perturb the data collected.  It is 14465000
          also true that a large interrupt interval will yield          14470000
          unreliable data.  Hence it is suggested that several          14475000
          experiments with different interrupt intervals be conducted so14480000
          that a feasible interval can be determined.                   14485000
                                                                        14490000
      E.  It is also suggested that the user set aside a few bits in the14495000
          available MEASINFOTAB words to synchronize the beginning and  14500000
          terminating of the data collection with the user process that 14505000
          calls GIVECLOCK(see Appendix A.).  DO NOT CALL GIVECLOCK FROM 14510000
          THE DATA COLLECTION PROCEDURE!                                14515000
                                                                        14520000
      F.  After each set of data are collected, be sure to call         14525000
          GIVECLOCK even if you intend to collect another set of data   14530000
          later.  You can specify a PLABEL of 0 to GIVECLOCK if you     14535000
          intend to collect another set of data a short while later but 14540000
          don't wish to release the clock to the system or to release   14545000
          the data collection procedure.  In doing so, the system clock 14550000
          will run at its normal interrupt rate of 100 ms during the    14555000
          transition time and reduce the overhead of the system.        14560000
                                                                        14565000
      G.  Finally, make sure to call GIVECLOCK again with the PLABEL of 14570000
          the data collection procedure as the input so that the clock  14575000
          will be released and other users will be able to share the    14580000
          system clock.  If you locked and froze any segments without   14585000
          GETCLOCK, be sure to unlock and unfreeze them!                14590000
$PAGE    "          SHARED CLOCK INTERFACE - PROCEDURES "               14595000
                          INTERFACE PROCEDURES                          14600000
I.   GETCLOCK                                                           14605000
Declaration:                                                            14610000
                                                                        14615000
     PROCEDURE GETCLOCK(INTRATE,PLABEL,ERRORN,XDS1,XDS2);               14620000
               VALUE PLABEL,XDS1,XDS2; INTEGER INTRATE, PLABEL,         14625000
               ERRORN,XDS1,XDS2; OPTION VARIABLE, PRIVILEGED,           14630000
               UNCALLABLE;                                              14635000
                                                                        14640000
Function:                                                               14645000
                                                                        14650000
     GETCLOCK will set-up the clock interrupt rate and lock and freeze  14655000
     the user data collection procedure.                                14660000
                                                                        14665000
Parameters:                                                             14670000
                                                                        14675000
     INTRATE(REQUIRED):  The input value is the requested interrupt     14680000
                         interval and the granted interval is the       14685000
                         returned value.  The returned value is         14690000
                         calculated as the largest divisor of 100 which 14695000
                         is within 10% of the requested value.  The     14700000
                         units are ms.                                  14705000
                                                                        14710000
                         A 0 INTRATE indicates initialization.  It will 14715000
                         cause all of the functions of GETCLOCK to be   14720000
                         performed except setting the new clock         14725000
                         interrupt rate and calling the user data       14730000
                         collection procedure.  Then the next call to   14735000
                         GETCLOCK with 0 PLABEL and correct INTRATE will14740000
                         start the data collection.                     14745000
                                                                        14750000
     PLABEL(REQUIRED):   The P-label is that of the user data collection14755000
                         procedure.  It can also be 0 if the user       14760000
                         already has his code segment locked and frozen 14765000
                         by a previous call to GETCLOCK.  He can then   14770000
                         call GIVECLOCK and GETCLOCK alternatively with 14775000
                         PLABEL set to zero to alter the clock interrupt14780000
                         rate or suspend data collection without losing 14785000
                         control of the clock.                          14790000
                                                                        14795000
     ERRORN(REQUIRED):   The returned value indicates the error         14800000
                         encountered.                                   14805000
                                                                        14810000
     XDS'S(OPTIONAL):    The DST index value returned by GETDSEG so that14815000
                         the XDSs will be locked and frozen in memory.  14820000
                                                                        14825000
Condition Codes and Returned Values:                                    14830000
                                                                        14835000
     CCE:      Request granted.  ERRORN = 0, INTRATE will be the granted14840000
               interrupt rate and the system clock is enabled to        14845000
               interrupt at that rate.  (NOTE:  If a non-zero INTRATE is14850000
               entered, then the system clock will be set at the new    14855000
               interrupt rate and the user's data collection procedure  14860000
               will be called at the specified interval. It is user's   14865000
               responsibility to synchronize the data collection        14870000
               activity and the clock from that point on.)              14875000
                                                                        14880000
     CCL:      Request denied.  The parameter ERRORN indicates the      14885000
               reason:                                                  14890000
                                                                        14895000
               1 --  missing parameter in GETCLOCK.                     14900000
               2 --  system clock is currently used by someone else.    14905000
               3 --  interrupt rate requested out of range.             14910000
               4 --  invalid P-label (if PLABEL is 0, this means that   14915000
                     GETCLOCK has not previously locked and frozen a    14920000
                     data collection procedure for this caller.)        14925000
               5 --  cannot lock or freeze code segment.                14930000
               6 --  cannot lock or freeze data segment.                14935000
               7 --  the user's data collection procedure is calling a  14940000
                     non-resident segment.                              14945000
               8 --  unable to obtain a sharable CST entry.             14950000
                                                                        14955000
     CCG:      Not returned by this procedure.                          14960000
                                                                        14965000
Comments:                                                               14970000
                                                                        14975000
    When the user data collection procedure is called, interrupts are   14980000
    enabled.  Hence it is user's responsibility to disable the          14985000
    interrupts if so he desires.  Also, every time his procedure is     14990000
    called, he should set the DB register upon entry and reset the DB   14995000
    register before exiting.                                            15000000
II.  GIVECLOCK                                                          15005000
Declaration:                                                            15010000
                                                                        15015000
     PROCEDURE GIVECLOCK(PLABEL);                                       15020000
               VALUE PLABEL;                                            15025000
               INTEGER PLABEL;                                          15030000
               OPTION PRIVILEGED,UNCALLABLE;                            15035000
                                                                        15040000
Function:                                                               15045000
                                                                        15050000
     GIVECLOCK will make sure that the caller is also the one who "owns"15055000
     the clock.  Then it unlocks and unfreezes the user data collection 15060000
     procedure and releases the sharable CST entry it occupied.  It also15065000
     unlocks and unfreezes the extra data segments, if any.  It then    15070000
     resets the clock interrupt rate back to the normal rate of 100 ms. 15075000
     However, if PLABEL is 0, then only the resetting of the clock      15080000
     interrupt rate is done.  In this case, the user can set and reset  15085000
     the clock without fear losing control of the clock and without     15090000
     relocking and freezing the data collection procedure.              15095000
                                                                        15100000
Parameters:                                                             15105000
                                                                        15110000
     PLABEL: This is the program label of the user's data collection    15115000
             procedure.  It is 0 if the user wants only to reset the    15120000
             clock but not to release control of the clock.             15125000
                                                                        15130000
Condition codes:                                                        15135000
                                                                        15140000
     CCE:  Request granted.                                             15145000
                                                                        15150000
     CCG:  Request denied.  The user does not "own" the clock.          15155000
                                                                        15160000
     CCL:  Request denied.  Can not unlock or unfreeze either the code  15165000
**********************************************************************>>15170000
 PROCEDURE GETINTRATE(IMS,INT,QN);                                      15175000
 INTEGER IMS,INT,QN;                                                    15180000
 OPTION UNCALLABLE;                                            <<04113>>15185000
 BEGIN                                                                  15190000
                                                                        15195000
<< THIS PROCEDURE RECEIVES THE REQUEST FROM THE USER.  >>               15200000
<< IMS IS THE REQUESTED INTERRUPT INTERVAL.  IT THEN   >>               15205000
<< COMPUTES THE LARGEST DIVISOR OF 100 SHCH THAT IT    >>               15210000
<< IS WITHIN 10% OF THE REQUESTED VALUE.  THE RETURNED >>               15215000
<< IS AS FOLLOWS:                                      >>               15220000
<<       IMS:  GRANTED INTERRUPT INTERVAL              >>               15225000
<<       INT:  CLOCK INTERRUPT RATE                    >>               15230000
<<       QN:   QUOTIENT = IMS/INT                      >>               15235000
                                                                        15240000
    INTEGER I,J,K,QI,TK;                                                15245000
    INTEGER ARRAY BASE(0:5) =PB := 100,50,25,20,10,5;                   15250000
                                                                        15255000
    IF 5 <= IMS <= 7  OR  13 <= IMS <= 17  THEN                         15260000
    BEGIN                                                               15265000
       INT := 5;                                                        15270000
       QN := (IMS+2)/5;                                                 15275000
       GOTO EXIT;                                                       15280000
    END;                                                                15285000
    IF 8 <= IMS <= 12  OR  IMS = 30  OR  IMS = 70  THEN                 15290000
    BEGIN                                                               15295000
       INT := 10;                                                       15300000
       QN := (IMS+2)/10;                                                15305000
       GOTO EXIT;                                                       15310000
    END;                                                                15315000
    IF 18 <= IMS <= 22  THEN                                            15320000
    BEGIN                                                               15325000
       INT := 20;                                                       15330000
       QN := 1;                                                         15335000
       GOTO EXIT;                                                       15340000
    END;                                                                15345000
    TK := IF IMS < 60  THEN  5  ELSE  IMS/10; << 10% OF IMS >>          15350000
    I := -1;                                                            15355000
    WHILE (I := I + 1) < 6  DO                                          15360000
    BEGIN                                                               15365000
       QI := IMS/BASE(I);                                               15370000
       J := IMS - QI*BASE(I);                                           15375000
       K := BASE(I) - J;                                                15380000
       IF J <= TK OR K < TK  THEN                                       15385000
       BEGIN                                                            15390000
          INT := BASE(I);                                               15395000
          QN := IF J <= K  THEN  QI  ELSE  QI+1;                        15400000
          GOTO EXIT;                                                    15405000
       END;                                                             15410000
    END;                                                                15415000
 EXIT:                                                                  15420000
    IMS := INT*QN;                                                      15425000
 END;                                                                   15430000
$PAGE    "          ******      CSTENTRY        ******"                 15435000
 INTEGER PROCEDURE CSTENTRY(INDEX,PLABEL);                              15440000
 VALUE INDEX,PLABEL;                                                    15445000
 INTEGER INDEX,PLABEL;                                                  15450000
 OPTION PRIVILEGED,UNCALLABLE;                                          15455000
 BEGIN                                                                  15460000
                                                                        15465000
<< THIS PROCEDURE GETS A SHARABLE CST ENTRY AND THEN   >>               15470000
<< COPY THE CONTENTS OF THE USER CSTX ENTRY INTO THAT  >>               15475000
<< SHARABLE ENTRY.  THE RETURNING VALUE IS THE NEW     >>               15480000
<< USER'S PROGRAM LABEL.                               >>               15485000
                                                                        15490000
    INTEGER I,CSTE;                                                     15495000
                                                                        15500000
    CSTENTRY := 0;                                                      15505000
    TOS := IF LOGICALMAPPING THEN GET'PHY'CST ELSE GETENTRY(1);<<06401>>15510000
    IF = THEN  RETURN  ELSE  CSTE := TOS&LSL(2);;                       15515000
    FOR I := 0  UNTIL  3  DO                                            15520000
        CSTI(CSTE + I) := DSTI(INDEX + I);                              15525000
    CSTENTRY := CSTE/4;                                        <<06401>>15530000
    CSTENTRY.(0:1) := 1;                                       <<06401>>15535000
    CSTENTRY.(1:7) := PLABEL.(1:7);                            <<06401>>15540000
 END;                                                                   15545000
$PAGE    "          ******      CHECKCST        ******"                 15550000
 PROCEDURE CHECKCST(INDEX);                                             15555000
 VALUE INDEX;                                                           15560000
 INTEGER INDEX;                                                         15565000
 OPTION PRIVILEGED,UNCALLABLE;                                          15570000
 BEGIN                                                                  15575000
                                                                        15580000
<< THIS PROCEDURE CHECKS THE USER CODE SEGMENT STT AREA TO >>           15585000
<< MAKE SURE THAT THE USER DOES NOT PCAL ANY NON-RESIDENT  >>           15590000
<< MPE SEGMENTS OR UN-FROZEN MEASIO.                       >>           15595000
                                                                        15600000
    INTEGER SEG, STTSIZE;                                               15605000
    DEFINE CORERESBIT=(7:1)#,    << CORE RESIDENT SEGMENT >>            15610000
           FREEZE=(6:1)#;        << SEGMENT FROZEN BIT >>               15615000
    INTEGER INT'STT'NO;                                        <<06401>>15620000
                                                                        15625000
     TOS := DSTI(INDEX+2);                << STACK BANK # >>   <<04313>>15630000
    TOS := DSTI(INDEX+3) - 1;                                           15635000
    TOS := DSTI(INDEX).(4:12)&LSL(2);    << STACK SIZE >>               15640000
     ASMB(LADD;LSEA); << GET # OF STT'S AT THE END OF STACK >> <<04313>>15645000
    INT'STT'NO := S0.(0:8);                                    <<06401>>15650000
    STTSIZE := TOS.(8:8) + 1;                                           15655000
    WHILE (STTSIZE := STTSIZE - 1) > 0  DO  << CHECK ALL STT >>         15660000
    BEGIN                                                               15665000
       TOS := TOS - 1;                                                  15670000
       ASMB(LSEA);                                                      15675000
       IF INT'STT'NO <= 0 AND LOGICALMAPPING OR                <<06401>>15680000
          S0 < 0 AND NOT LOGICALMAPPING THEN <<EXT. PCAL>>     <<06401>>15685000
       BEGIN                                                            15690000
          IF NOT LABEL'IS'SL'SEG(S0,0) THEN                    <<06401>>15695000
          BEGIN                                                         15700000
             CC := CCL;                                                 15705000
             RETURN;                                                    15710000
          END;                                                          15715000
          SEG := TOS.(8:8)&LSL(2);      << FOR CSTX ENTRY >>            15720000
          IF  NOT LOGICAL(CSTI(SEG+1)).CORERESBIT  THEN                 15725000
          BEGIN                                                         15730000
             TOS := CSTI(SEG+2);                                        15735000
             TOS := CSTI(SEG+3) - 19;                                   15740000
             ASMB(LSEA);                                                15745000
             IF  NOT TOS.FREEZE  THEN                                   15750000
             BEGIN                                                      15755000
                CC := CCG;                                              15760000
                RETURN;                                                 15765000
             END  ELSE  ASMB(DDEL);                                     15770000
          END;                                                          15775000
       END  ELSE  ASMB(DEL);                                            15780000
       INT'STT'NO := INT'STT'NO - 1;                           <<06401>>15785000
    END;                                                                15790000
    CC := CCE;                                                          15795000
 END;                                                                   15800000
$PAGE    "          ******      SETBIT          ******"        <<01836>>15805000
 PROCEDURE SETBIT(FLAG);                                       <<01836>>15810000
 VALUE FLAG;                                                   <<01836>>15815000
 LOGICAL FLAG;                                                 <<01836>>15820000
 OPTION PRIVILEGED,UNCALLABLE;                                 <<01836>>15825000
 BEGIN                                                         <<01836>>15830000
                                                               <<01836>>15835000
<< THIS PROCEDURE SET OR RESET(ACCORDING TO THE LOGICAL >>     <<01836>>15840000
<< VALUE OF FLAG) BIT 2 OF PXFIXED(%26).  THIS IS DONE  >>     <<01836>>15845000
<< BEFORE THE USER WAS GRANTED THE USE OF THE SYSTEM    >>     <<01836>>15850000
<< CLOCK.  THIS BIT WILL BE CHECK BY GIVECLOCK.         >>     <<01836>>15855000
                                                               <<01836>>15860000
    LOGICAL ARRAY QARRAY(*) = Q+0;                             <<07068>>15865000
    LOGICAL PXFIXEDLOC;                                        <<07068>>15870000
                                                               <<01836>>15875000
    PXFIXED;                                                   <<07068>>15880000
    STATUS.(6:2) := CCE;                                       <<01836>>15885000
    IF FLAG THEN PXFXCLKSHARE:=1 ELSE                          <<07068>>15890000
    BEGIN                                  << CLEAR BIT >>     <<01836>>15895000
       TOS := PXFXCLKSHARE;<<TO TEST CLKSHARE BIT >>           <<07068>>15900000
       ASMB ( TRBC 15 );  << TEST AND RESET BIT 11 >>          <<07068>>15905000
       IF  =  THEN  STATUS.(6:2) := CCL      << BIT WAS SET>>  <<01836>>15910000
                 ELSE PXFXCLKSHARE:= TOS;                      <<07068>>15915000
    END;                                                       <<01836>>15920000
 END;                                                          <<01836>>15925000
$PAGE    "          ******      GETCLOCK        ******"        <<01836>>15930000
 PROCEDURE GETCLOCK(INTRATE,PLABEL,ERRORN,XDS1,XDS2);          <<01836>>15935000
 VALUE PLABEL,XDS1,XDS2;                                       <<01836>>15940000
 INTEGER INTRATE,PLABEL,ERRORN,XDS1,XDS2;                      <<01836>>15945000
 OPTION VARIABLE,PRIVILEGED,UNCALLABLE;                        <<01836>>15950000
 BEGIN                                                         <<01836>>15955000
                                                               <<01836>>15960000
<< THIS PROCEDURE IS CALLED BY A USER TO REQUEST THE CHANGE >> <<01836>>15965000
<< OF SYSTEM CLOCK INTERRUPT INTERVAL.  IT ALSO MAKES SURE  >> <<01836>>15970000
<< THAT NO ONE IS CURRENTLY SHARING THE CLOCK.  ALSO, IT    >> <<01836>>15975000
<< LOCKS AND FREEZES THE CODE SEGMENT AND, IF ANY, DATA     >> <<01836>>15980000
<< SEGMENTS THAT WAS SUPPLIED BY THE USER VIA THE PRAMETERS.>> <<01836>>15985000
<< IT THEN ENABLES THE CLOCK TO RUN AT THE REQUESTED RATE.  >> <<01836>>15990000
                                                               <<01836>>15995000
    EQUATE  PCBSIZE  =  21;   << PCB ENTRY SIZE >>             <<07068>>16000000
    INTEGER I, LP, INT, QN, CSTN, PIN, PINX, INDEX,            <<01836>>16005000
            CLKCOUNT, NEWLABEL, V := 1;                        <<01836>>16010000
    LOGICAL MASK = Q-4;                                        <<01836>>16015000
    POINTER P;                                                 <<01836>>16020000
    DEFINE FLAG = MEASINFOTABPTR(56)#;                         <<06401>>16025000
    INTEGER TFLAG1,TFLAG2;   << TEMPERARY FLAGS >>             <<06401>>16030000
LOGICAL ARRAY QARRAY(*)=Q+0;                                   <<07068>>16035000
LOGICAL PXFIXEDLOC;                                            <<07068>>16040000
                                                               <<01836>>16045000
    CC := CCL;                                                 <<01836>>16050000
    TOS := MASK.(11:3);                                        <<01836>>16055000
    IF S0 < 7  THEN            << MISSING PARAMETERS >>        <<01836>>16060000
    BEGIN                                                      <<01836>>16065000
       ERRORN := 1;                                            <<01836>>16070000
       RETURN;                                                 <<01836>>16075000
    END;                                                       <<01836>>16080000
                                                               <<01836>>16085000
    ASMB(PCN);  << PUSH PCB # >>                               <<01836>>16090000
    LP :=  IF TOS <= 2  THEN  %17  ELSE  17;                   <<01836>>16095000
    IF  PLABEL <> 0  THEN    << FIRST TIME USER >>             <<01836>>16100000
    BEGIN                                                      <<01836>>16105000
       IF PLABEL.(8:8) = 0 THEN                                <<06401>>16110000
       BEGIN     << INVALID PLABEL >>                          <<01836>>16115000
          ERRORN := 4;                                         <<01836>>16120000
          RETURN;                                              <<01836>>16125000
       END;                                                    <<01836>>16130000
       PDISABLE;         << CHECK AVAILIBILITY OF THE CLOCK >> <<01836>>16135000
       IF  ABS(LP).(1:15) > 0  THEN  GOTO  BUSYCLOCK;          <<01836>>16140000
       FOR  I := 56 UNTIL 63  DO                               <<01836>>16145000
       IF  MEASINFOTABPTR(I) <> 0  THEN                        <<01836>>16150000
       BEGIN                                                   <<01836>>16155000
 BUSYCLOCK:                                                    <<01836>>16160000
          PENABLE;                                             <<01836>>16165000
          ERRORN := 2;                                         <<01836>>16170000
          RETURN;                                              <<01836>>16175000
          HELP;              << DUMMY CALL FOR DEBUG >>        <<01836>>16180000
       END;                                                    <<01836>>16185000
       SETBIT(TRUE);     <<SET PXFIXED (%6).(11:1) >>          <<07068>>16190000
       DLABEL := PLABEL;                                       <<06401>>16195000
       TFLAG1 := 1;                                            <<06401>>16200000
       FLAG.(1:1) := 1;                                        <<06401>>16205000
       PENABLE;                                                <<01836>>16210000
    END  ELSE                                                  <<01836>>16215000
    BEGIN                                                      <<01836>>16220000
      PXFIXED;                                                 <<07068>>16225000
      IF NOT PXFXCLKSHARE THEN << HE TRIES TO SNEAK IN >>      <<07068>>16230000
       BEGIN                                                   <<01836>>16235000
          ERRORN := 9;                                         <<01836>>16240000
          RETURN;                                              <<01836>>16245000
       END;                                                    <<01836>>16250000
       TFLAG1 := 0;                                            <<06401>>16255000
    END;                                                       <<01836>>16260000
                                                               <<01836>>16265000
    IF INTRATE = 0  THEN                                       <<01836>>16270000
    BEGIN         << INITIALIZATION >>                         <<01836>>16275000
       QN := 0;                                                <<01836>>16280000
       CLKCOUNT := 0;                                          <<01836>>16285000
       V := 0;                                                 <<01836>>16290000
       TFLAG1 := 0;                                            <<06401>>16295000
       GOTO LOCKCST;                                           <<01836>>16300000
    END;                                                       <<01836>>16305000
                                                               <<01836>>16310000
    IF  ABS(LP).(1:15) > 0 OR DLABEL = 0  THEN                 <<01836>>16315000
    BEGIN           << CANNOT RESET RATE IF CLOCK IN USE >>    <<01836>>16320000
       ERRORN := 10;                                           <<01836>>16325000
       RETURN;                                                 <<01836>>16330000
    END;                                                       <<01836>>16335000
    IF  NOT (5 <= INTRATE <= 1000)  THEN                       <<01836>>16340000
    BEGIN  << INTERRUPT RATE OUT OF RANGE >>                   <<01836>>16345000
       ERRORN := 3;                                            <<01836>>16350000
       IF  PLABEL = 0  THEN  RETURN  ELSE  GOTO  SIMPLE'EXIT;  <<01836>>16355000
    END;                                                       <<01836>>16360000
    GETINTRATE(INTRATE,INT,QN);<< GET OPTIMAL INTERRUPT RATE >><<01836>>16365000
    CLKCOUNT := 100/INT;                                       <<01836>>16370000
    IF PLABEL=0  THEN                                          <<01836>>16375000
    BEGIN                                                      <<01836>>16380000
       NEWLABEL := DLABEL;                                     <<06401>>16385000
       TFLAG2 := 1;                                            <<06401>>16390000
       GOTO DONE;                                              <<01836>>16395000
    END;                                                       <<01836>>16400000
                                                               <<01836>>16405000
 LOCKCST:                                                      <<01836>>16410000
   CSTN := PLABEL;                                             <<06401>>16415000
    IF =  THEN                                                 <<01836>>16420000
    BEGIN                                                      <<01836>>16425000
       ERRORN := 4;                                            <<01836>>16430000
       GOTO  SIMPLE'EXIT;                                      <<01836>>16435000
    END;                                                       <<01836>>16440000
    LOCKSEG(CSTN,0,0);                                         <<01836>>16445000
    IF <>  THEN                                                <<01836>>16450000
    BEGIN                                                      <<01836>>16455000
       ERRORN := 5;                                            <<01836>>16460000
       GOTO  SIMPLE'EXIT;                                      <<01836>>16465000
    END;                                                       <<01836>>16470000
    FREEZE(CSTN,0,0);                                          <<01836>>16475000
    IF <>  THEN                                                <<01836>>16480000
    BEGIN                                                      <<01836>>16485000
       ERRORN := 5;                                            <<01836>>16490000
       GOTO EXIT;                                              <<01836>>16495000
    END;                                                       <<01836>>16500000
    IF MASK  THEN                                              <<01836>>16505000
    BEGIN                   << LOCK AND FREEZE SECOND EDS >>   <<01836>>16510000
       LOCKSEG(XDS2,1,0);                                      <<01836>>16515000
       IF <>  THEN                                             <<01836>>16520000
       BEGIN                                                   <<01836>>16525000
          ERRORN := 6;                                         <<01836>>16530000
          GOTO EXIT;                                           <<01836>>16535000
       END;                                                    <<01836>>16540000
       FREEZE(XDS2,1,0);                                       <<01836>>16545000
       IF <>  THEN                                             <<01836>>16550000
       BEGIN                                                   <<01836>>16555000
          ERRORN := 6;                                         <<01836>>16560000
          GOTO EXIT;                                           <<01836>>16565000
       END;                                                    <<01836>>16570000
    END  ELSE  XDS2 := 0;                                      <<01836>>16575000
    IF MASK&LSR(1)  THEN    << LOCK AND FREEZE FIRST EDS >>    <<01836>>16580000
    BEGIN                                                      <<01836>>16585000
       LOCKSEG(XDS1,1,0);                                      <<01836>>16590000
       IF <>  THEN                                             <<01836>>16595000
       BEGIN                                                   <<01836>>16600000
          ERRORN := 6;                                         <<01836>>16605000
          GOTO EXIT;                                           <<01836>>16610000
       END;                                                    <<01836>>16615000
       FREEZE(XDS1,1,0);                                       <<01836>>16620000
       IF <>  THEN                                             <<01836>>16625000
       BEGIN                                                   <<01836>>16630000
          ERRORN := 6;                                         <<01836>>16635000
          GOTO EXIT;                                           <<01836>>16640000
       END;                                                    <<01836>>16645000
    END  ELSE  XDS1 := 0;                                      <<01836>>16650000
                                                               <<01836>>16655000
    PINX := ABS(4) - ABS(3);                                   <<01836>>16660000
    PIN := PINX/PCBSIZE;                                       <<01836>>16665000
   INDEX := CSTCONV(CSTN,PINX);                                <<06401>>16670000
    CHECKCST(INDEX);       << CHECK USER STT AREA >>           <<01836>>16675000
    IF <>  THEN                                                <<01836>>16680000
    BEGIN                                                      <<01836>>16685000
       ERRORN := 7;                                            <<01836>>16690000
       GOTO EXIT;                                              <<01836>>16695000
    END;                                                       <<01836>>16700000
    IF NOT LABEL'IS'SL'SEG(CSTN,PINX) AND CSTN <> 0 THEN       <<06401>>16705000
    BEGIN                                                      <<01836>>16710000
       NEWLABEL := CSTENTRY(INDEX,PLABEL);                     <<01836>>16715000
       IF  =  THEN                                             <<01836>>16720000
       BEGIN                                                   <<01836>>16725000
          ERRORN := 8;                                         <<01836>>16730000
    EXIT:                                                      <<01836>>16735000
          IF  MASK  THEN                                       <<01836>>16740000
          BEGIN                                                <<01836>>16745000
             UNFREEZE(XDS2,1,0);                               <<01836>>16750000
             UNLOCKSEG(XDS2,1,0);                              <<01836>>16755000
          END;                                                 <<01836>>16760000
          IF  MASK&LSR(1)  THEN                                <<01836>>16765000
          BEGIN                                                <<01836>>16770000
             UNFREEZE(XDS1,1,0);                               <<01836>>16775000
             UNLOCKSEG(XDS1,1,0);                              <<01836>>16780000
          END;                                                 <<01836>>16785000
          UNFREEZE(CSTN,0,PINX);                               <<01836>>16790000
          UNLOCKSEG(CSTN,0,PINX);                              <<01836>>16795000
 SIMPLE'EXIT:                                                  <<01836>>16800000
          DLABEL := 0;                                         <<01836>>16805000
          FLAG.(1:1) := 0;                                     <<06401>>16810000
          SETBIT(FALSE);                                       <<01836>>16815000
          RETURN;                                              <<01836>>16820000
       END;                                                    <<01836>>16825000
    END  ELSE  NEWLABEL := PLABEL;                             <<01836>>16830000
    TFLAG2 := TFLAG1;                                          <<06401>>16835000
                                                               <<01836>>16840000
    ABS(LP) := %100000; << INDICATES SHARED CLOCK HAS USED >>  <<01836>>16845000
    XDS1INDEX := XDS1;                                         <<01836>>16850000
    XDS2INDEX := XDS2;                                         <<01836>>16855000
 DONE:                                                         <<01836>>16860000
    CC := CCE;                                                 <<01836>>16865000
    ERRORN := 0;                                               <<01836>>16870000
    DISABLE;     << ENABLE THE CLOCK WITH NEW RATE >>          <<01836>>16875000
    DCOUNT := V;                                               <<01836>>16880000
    DLIMIT := QN;                                              <<01836>>16885000
    TCOUNT := V;                                               <<01836>>16890000
    TLIMIT := CLKCOUNT;                                        <<01836>>16895000
    DLABEL := NEWLABEL;                                        <<01836>>16900000
    FLAG.(1:1) := TFLAG2;                                      <<06401>>16905000
    ENABLE;                                                    <<01836>>16910000
    DELAY(200D);                                               <<01836>>16915000
 END;                                                          <<01836>>16920000
$CONTROL SEGMENT=MAIN                                          <<01836>>16925000
END.                                                           <<01836>>16930000
