| 1 | XMUT5C ;(WASH ISC)/CAP-Response Time Logger/Purge ;04/17/2002  11:59 | 
|---|
| 2 | ;;8.0;MailMan;;Jun 28, 2002 | 
|---|
| 3 | ; Entry points used by MailMan options (not covered by DBIA): | 
|---|
| 4 | ; GO     XMMGR-RESPONSE-TIME-COMPILER | 
|---|
| 5 | ; LOGON  XMMGR-RESPONSE-TIME-TOGGLER | 
|---|
| 6 | I '$D(ZTQUEUED) U IO(0) W !!,"Compiling Data..." | 
|---|
| 7 | GO ;Entry for Tasked report | 
|---|
| 8 | ; | 
|---|
| 9 | S XMV=^%ZOSF("PROD"),(D,Z)=0 | 
|---|
| 10 | ; | 
|---|
| 11 | ;Are there statistics to gather ?  Only gather statistics till T-1. | 
|---|
| 12 | ; | 
|---|
| 13 | ;Is there a date ? | 
|---|
| 14 | Z S Z=$O(^%ZRTL(3,XMV,Z)) G Q:$H-Z'>0,Q:Z="" | 
|---|
| 15 | ;Is there Response Time data for MailMan ? | 
|---|
| 16 | S J=$O(^%ZRTL(3,XMV,Z,"XMA1-DEL/TERM",0)) D S:J | 
|---|
| 17 | ; | 
|---|
| 18 | ;Kill off Response time data for this date (stored in XMBX now) | 
|---|
| 19 | K ^%ZRTL(3,XMV,Z,"XMA1-DEL/TERM") G Z | 
|---|
| 20 | ; | 
|---|
| 21 | ;Gather 1 days' statistics | 
|---|
| 22 | S S %H=Z D YMD^%DTC S (E,XMA)=X,S=0 | 
|---|
| 23 | I '$D(ZTQUEUED) W !,"DATE="_$$FMTE^XLFDT($P(XMA,".",1),"2Z"),! S D=D+1 | 
|---|
| 24 | 0 S XMA=$O(^XMBX(4.2998,"B",XMA)) I $S('XMA:1,XMA-E>.999:1,1:0) Q | 
|---|
| 25 | S %=$P(XMA,".",2),L=$E(%,1,2)*3600+($E(%,3,4)*60)+$E(%,5,6),(C,T)=0 D G | 
|---|
| 26 | S %=$O(^XMBX(4.2998,"B",XMA,0)),$P(^XMBX(4.2998,%,0),U,8)=$S(C>0:$FN(T/C,"",1),1:"") | 
|---|
| 27 | G 0 | 
|---|
| 28 | ; | 
|---|
| 29 | ;Get response time out of %ZRTL | 
|---|
| 30 | G S S=$O(^%ZRTL(3,XMV,Z,"XMA1-DEL/TERM",S)) Q:S=""  I S>L S S=L Q | 
|---|
| 31 | S %=^(S),C=C+1,T=S-$P($P(%,"^"),",",2)+T I '$D(ZTQUEUED),C#100=0 W "." | 
|---|
| 32 | G G | 
|---|
| 33 | ; | 
|---|
| 34 | ;Write totals and quit | 
|---|
| 35 | Q I '$D(ZTQUEUED) W !!,?2,$S(D:D_" Dates Processed and Purged",1:"<<<< Nothing to process >>>>"),! | 
|---|
| 36 | K %,%H,%I,C,D,E,J,L,S,T,X,Y,Z,XMA,XMC,XMD,XMV | 
|---|
| 37 | Q | 
|---|
| 38 | ZTSK S ZTRTN="GO^XMUT5C",ZTDTH=$S($D(ZTQUEUED):1,1:0)+$H_","_(3600*18),ZTDESC="Response Time accumulator for file 4.2998",ZTIO="" D ^%ZTLOAD | 
|---|
| 39 | Q | 
|---|
| 40 | LOGON ;Turn ON response time logging | 
|---|
| 41 | S X="y" D LOG | 
|---|
| 42 | ;Schedule next task | 
|---|
| 43 | K ZTREQ S ZTIO="",ZTRTN="LOGOFF^XMUT5C",X=$P($H,",",2),ZTDESC="Turn OFF response Time Logging" | 
|---|
| 44 | K % I X<28800 S %=+$H_",29100" | 
|---|
| 45 | I X>57600 S %=$H+1_",29100" | 
|---|
| 46 | I $D(%) S ZTDTH=% | 
|---|
| 47 | E  S %=$H*86400+X+300,ZTDTH=%\86400_","_(%#86400) | 
|---|
| 48 | D ^%ZTLOAD S ZTREQ="@" Q | 
|---|
| 49 | LOGOFF ;Turn OFF response time logging | 
|---|
| 50 | S X="n" | 
|---|
| 51 | ;Update Kernel Site Parameters LOG RESPONSE TIME FIELD | 
|---|
| 52 | LOG L +^XTV(8989.3,1) | 
|---|
| 53 | S %=^%ZOSF("VOL"),%=$O(^XTV(8989.3,1,4,"B",%,0)),$P(^XTV(8989.3,1,4,%,0),U,6)=X | 
|---|
| 54 | L -^XTV(8989.3,1) K %,X S ZTREQ="@" | 
|---|
| 55 | Q | 
|---|