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       fnp metering subroutines
 11           lbl       ,meters
 12           pcc       off
 13           pmc       on
 14           editp     on
 15           rem
 16 *************************************************************
 17 *
 18 *         this set of subroutines implements the updating of
 19 *         meters kept by the fnp
 20 *
 21 *         it has entries for incrementing single- and double-
 22 *         word meters, for updating cumulative meters
 23 *         intended for maintaining averages, and for keeping
 24 *         track of synchronous message counts and lengths.
 25 *
 26 *         all entries must run with interrupts and overflow
 27 *         faults inhibited.
 28 *
 29 *************************************************************
 30           rem
 31 meters    null
 32           start     meters
 33           rem
 34           symdef    mincs
 35           symdef    mincd
 36           symdef    mupdat
 37           symdef    mmsg
 38           rem
 39           symref    setbpt
 40           rem
 41           buffer
 42           ttls      mincs, mincd -- simple increment meters
 43           pmc       off
 44           rem
 45 *************************************************************
 46 *
 47 *         mincs -- single precision increment
 48 *
 49 *         inputs:
 50 *             a -- address of single-word meter
 51 *             q -- increment (positive or negative)
 52 *
 53 *************************************************************
 54           rem
 55 mincs     subr      ics,(inh,x2)
 56           ldi       l.a001-*  inhbit interrupts and overflow
 57           cax2                get address of meter
 58           cqa
 59           asa       0,2       update it
 60           return    mincs
 61           rem
 62           rem
 63 *************************************************************
 64 *
 65 *         mincd -- increment a double-precision meter
 66 *
 67 *         inputs:
 68 *             a -- address of doubleword to update
 69 *             q -- increment (positive or negative)
 70 *
 71 *************************************************************
 72           rem
 73 mincd     subr      icd,(inh,x2)
 74           ldi       l.a001-*  inhibit interrupts and overflow
 75           cax2                get address of meter
 76           cqa
 77           lrs       18        get double-precision increment in aq
 78           adaq      0,2       update meter
 79           staq      0,2
 80           return    mincd
 81           ttls      mupdat -- update cumulative meter
 82           rem
 83 *************************************************************
 84 *
 85 *         mupdat -- updates a cumulative meter for averaging
 86 *
 87 *         inputs:
 88 *             a -- address of doubleword meter, followed by
 89 *                  doubleword count of updates
 90 *
 91 *             q -- increment (positive or negative)
 92 *
 93 *************************************************************
 94           rem
 95 mupdat    subr      upd,(inh,x2)
 96           ldi       l.a001-*  inhibit interrupts and overflow
 97           cax2                get address of meter
 98           cqa
 99           lrs       18        get doubleword increment in aq
100           adaq      0,2
101           staq      0,2       update meter
102           ila       0         get double-precision 1
103           ilq       1
104           adaq      2,2       add it to update count
105           staq      2,2
106           return    mupdat
107           ttls      mmsg -- update count & length of message
108           rem
109 *************************************************************
110 *
111 *         mmsg -- increments counts and maintains average
112 *                 length for synchronous messages. also
113 *                 keeps track of minimum and maximum length
114 *
115 *         inputs:
116 *             a -- address of 6-word area containing the
117 *                  following:
118 *                  message count (2 words)
119 *                  cumulative message length (2 words)
120 *                  minimum message length (1 word)
121 *                  maximum message length (1 word)
122 *
123 *             x3 - address of first buffer in message
124 *
125 *************************************************************
126           rem
127 mmsg      subr      msg,(inh,x2,x3)
128           ldi       l.a001-*  inhibit interrupts and overflows
129           cax2                get address of metering area
130           stz       maccum-*  initialize total length
131           cx3a
132           tze       msgbak-*  no message, never mind
133           rem
134 msg010    tsy       a.a001-*,*          setbpt
135           cax3
136           lda       bf.tly,3  get the buffer tally
137           ana       l.a002-*  =buftmk
138           asa       maccum-*  increment running total
139           lda       bf.flg,3  last buffer in message?
140           cana      l.a003-*  =bfflst
141           tnz       msg020-*  yes, stop counting
142           lda       bf.nxt,3  next buffer
143           tnz       msg010-*  if any
144           rem
145 msg020    ila       0         get double-precision 1
146           ilq       1
147           adaq      0,2       update message count
148           staq      0,2
149           ila       0
150           ldq       maccum-*  get accumulated message length
151           adaq      2,2
152           staq      2,2       add it into total lengths
153           ldq       maccum-*  get message length again
154           szn       4,2       was the minimum ever set?
155           tze       msg040-*  no, just set min. and max.
156           cmpq      4,2       check minimum
157           tpl       msg030-*  we haven't got a new one
158           stq       4,2       we do, store it
159           tra       msgbak-*  done
160           rem
161 msg030    cmpq      5,2       check maximum
162           tmi       msgbak-*  we haven't beaten it
163           stq       5,2       we have, store new one
164           tra       msgbak-*
165           rem
166 msg040    stq       4,2       first time, set both
167           stq       5,2
168 msgbak    return    mmsg
169           rem
170           ttls      storage for all metering subroutines
171           rem
172 l.a001    oct       024000    bits to inhibit interrupts and overflow
173 l.a002    zero      buftmk
174 l.a003    vfd       18/bfflst
175           rem
176 a.a001    ind       setbpt
177           rem
178 maccum    bss       1         for accumulate length of current message
179           rem
180           end