1 * ***********************************************************
  2 * *                                                         *
  3 * * Copyright, (C) Honeywell Information Systems Inc., 1982 *
  4 * *                                                         *
  5 * * Copyright (c) 1972 by Massachusetts Institute of        *
  6 * * Technology and Honeywell Information Systems, Inc.      *
  7 * *                                                         *
  8 * ***********************************************************
  9 
 10           ttl       module to monitor performce by sampling ic
 11           lbl       ,ic_sampler
 12           pmc       off
 13           pcc       on
 14           editp     on
 15           rem
 16           symref    etrip     start of elapsed timer handler - contains ic
 17           symref    sked      lowest address to check
 18           symref    idlmrk    start of idle loop
 19           symref    idlend    end of idle loop
 20           symref    intp      beginning of interpreter
 21           symref    intend    end of interpreter
 22           rem
 23           symdef    icmon     routine to do the work
 24           symdef    icmdat    data base for external programs
 25           rem
 26           rem
 27 *         this module is controlled by data in the following table.
 28 *         the format of this table is known to ring-4 multics
 29 *         software (debug_fnp), from where it is read and patched.
 30           rem
 31 icsamp    null
 32           start     icsamp
 33           rem
 34           even
 35 icmdat    null
 36 action    oct       0         multics sets this to request action
 37           rem                 1 = start monitoring
 38           rem                 2 = stop monitoring
 39           rem                 3 = clear table
 40 confrm    oct       0         we set this to confirm receipt of action
 41           rem                 1 = action performed
 42           rem                 2 = illegal action
 43 enable    oct       0         when non-zero, monitoring is on
 44 tbaddr    ind       table     address of data area
 45 tblen     ind       ltable    number of words (2 per bucket)
 46 shift     oct       5         amount to shift address (bucket size)
 47 base      ind       sked      lowest address to watch
 48           even
 49 orange    oct       0,0       count of out-of-range samples
 50 ilpcnt    oct       0,0       count of samples in idle loop
 51           eject
 52 icmon     subr      icm,(x1,x2)
 53           rem
 54 *         first, perform any outstanding actions
 55 *         ring-4 multics software sets an action code. this module responds
 56 *         by performing the action next time is is called and
 57 *         storing a confirmation in 'confrm'
 58           rem
 59           lda       action-*  pick up the code
 60           tze       icm070-*  no request
 61           icmpa     1         start?
 62           tze       icm010-*
 63           icmpa     2         stop?
 64           tze       icm020-*
 65           icmpa     3         clear?
 66           tze       icm030-*
 67           ila       2         invalid action
 68           tra       icm060-*  go report it
 69           rem
 70 icm010    ila       1         start
 71           sta       enable-*
 72           tra       icm050-*
 73           rem
 74 icm020    stz       enable-*  stop
 75           tra       icm050-*
 76           rem
 77 icm030    ldx1      tbaddr-*  first addr to clear
 78           ila       0
 79           sba       tblen-*   get -length
 80           ars       1         convert to -double words
 81           sta       icmtmp-*
 82           ila       0
 83           ilq       0
 84 icm040    staq      0,1       clear the table
 85           iacx1     2
 86           aos       icmtmp-*
 87           tmi       icm040-*
 88           staq      orange-*  clear out-of-range too
 89           staq      ilpcnt-*  and times at the dis
 90           rem
 91 icm050    ila       1         report success
 92 icm060    sta       confrm-*
 93           stz       action-*
 94           eject
 95 *         now, compute a bucket number and record ic
 96           rem
 97 icm070    szn       enable-*  are we monitoring?
 98           tze       icmret-*  no
 99           lda       shift-*   build shift instruction
100           ora       l.a001-*  =arl 0
101           sta       icm080-*
102           lda       a.a001-*,*          =etrip, the ic interrupted
103           cmpa      a.a003-*  =addr(idloop-1) are we in idle loop?
104           tmi       icm075-*  no, we're before the beginning
105           cmpa      a.a005-*  =addr(idlend+1) check end
106           tmi       icm110-*  we're idle, meter it as such
107 icm075    cmpa      a.a006-*  addr(intp) within interpreter?
108           tmi       icm077-*  no
109           cmpa      a.a007-*  addr(intend) maybe
110           tpl       icm077-*  no
111           lda       icmsx2-*  yes, use x2 instead (op block address)
112 icm077    sba       base-*    get offset
113           tmi       icm090-*  out of range
114 icm080    arl       *-*       divide to get bucket number
115           als       1         multiply by 2 (for double word)
116           cmpa      tblen-*   too high?
117           tpl       icm090-*  yes
118           ada       tbaddr-*  compute bucket address
119           cax1
120           tra       icm100-*
121           rem
122 icm110    ldx1      a.a004-*  =ilpcnt, addr of idle bucket
123           tra       icm100-*
124           rem
125 icm090    ldx1      a.a002-*  use out-or-range bucket
126           rem
127 icm100    ila       0
128           ilq       1         build a 1
129           adaq      0,1
130           staq      0,1
131           rem
132 icmret    return    icmon
133           rem
134           rem
135 icmtmp    bss       1
136 a.a001    ind       etrip
137 a.a002    ind       orange
138 a.a003    ind       idlmrk    one location before idloop
139 a.a004    ind       ilpcnt
140 a.a005    ind       idlend+1
141 a.a006    ind       intp
142 a.a007    ind       intend
143 l.a001    arl       0
144           rem
145           rem
146           even
147 table     bss       2000
148 ltable    equ       *-table
149           rem
150           end