source: WorldVistAEHR/trunk/r/CAPACITY_MANAGEMENT_TOOLS-KMPD-KMPL/KMPDTP5.m@ 1432

Last change on this file since 1432 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.7 KB
RevLine 
[613]1KMPDTP5 ;OAK/RAK - CP Timing Threshold Alert ;6/21/05 10:15
2 ;;2.0;CAPACITY MANAGEMENT TOOLS;**4**;Mar 22, 2002
3 ;
4EN ;-- entry point
5 ;
6 N I,KMPDATE,KMPDSRCH,KMPDTSEC,KMPDTTL,POP,X,Y
7 N ZTDESC,ZTRTN,ZTRSAVE,ZTSK,%ZIS
8 ;
9 S KMPDTTL=" Coversheet Time-to-Load (TTL) Alert Report "
10 D HDR^KMPDUTL4(KMPDTTL)
11 W !
12 W !?7,"This alerting report shows the particular coversheet loads"
13 W !?7,"that had excessive time-to-load values. This report will"
14 W !?7,"search for a particular person, a particular client name or"
15 W !?7,"IP address."
16 W !
17 ;
18 ; if no data
19 I '$O(^KMPD(8973.2,0)) D Q
20 .W !!?7,"*** There is currently no data in file #8973.2 (CP TIMING) ***"
21 ;
22 ; date & hour(s)
23 D DTTMRNG^KMPDTU10("ORWCV",1,.KMPDATE,8)
24 Q:$G(KMPDATE(0))=""
25 Q:$G(KMPDATE(1))=""
26 ;
27 ; time-to-load threshold seconds
28 S KMPDTSEC=$$TTLSEC^KMPDTU10
29 Q:'KMPDTSEC
30 ;
31 ; search by
32 D SRCHBY^KMPDTU10(.KMPDSRCH,"ORWCV")
33 Q:'KMPDSRCH
34 ;
35 ; select output device.
36 S %ZIS="Q",%ZIS("A")="Device: ",%ZIS("B")="HOME"
37 W ! D ^%ZIS I POP W !,"No action taken." Q
38 ; if queued.
39 I $D(IO("Q")) K IO("Q") D Q
40 .S ZTDESC=KMPDTTL
41 .S ZTRTN="EN1^KMPDTP5"
42 .F I="KMPDATE(","KMPDSRCH(","KMPDTSEC","KMPDTTL" S ZTSAVE(I)=""
43 .D ^%ZTLOAD W:$G(ZTSK) !,"Task #",ZTSK
44 .D EXIT
45 ;
46 ; if output to terminal display message.
47 W:$E(IOST,1,2)="C-" !,"Compiling timing stats..."
48 D EN1
49 ;
50 Q
51 ;
52EN1 ;-- entry point from taskman
53 I '$D(KMPDATE) D EXIT Q
54 I '$D(KMPDSRCH) D EXIT Q
55 I '$G(KMPDTSEC) D EXIT Q
56 I $G(KMPDTTL)="" D EXIT Q
57 ;
58 K ^TMP($J)
59 U IO
60 D DATA,PRINT,EXIT
61 K ^TMP($J)
62 Q
63 ;
64DATA ;-- compile data
65 ;
66 Q:'$D(KMPDATE)
67 Q:'$G(KMPDSRCH)
68 Q:'$G(KMPDTSEC)
69 ;
70 N DATA,DATE,DATE1,DELTA,DOT,END,GBL,HOUR,HR,I,IEN,QUEUED,TIME,XREF
71 ;
72 S DOT=1,QUEUED=$D(ZTQUEUED)
73 ; set up HOUR() array
74 F I=1:1:24 S:$P(KMPDATE(1),",",I)'="" HOUR(+$P(KMPDATE(1),",",I))=""
75 Q:'$D(HOUR)
76 S DATE=$P(KMPDATE(0),U)-.1,END=$P(KMPDATE(0),U,2)+.9
77 Q:'DATE!('END)
78 S GBL=$$GLOBAL(.KMPDSRCH) Q:GBL=""
79 F S DATE=$O(@GBL@(DATE)) Q:'DATE!(DATE>END) D
80 .; determine hour
81 .S HR=+$E($P(DATE,".",2),1,2)
82 .S HR=$S(HR="":0,HR=24:0,1:HR)
83 .; quit if not in HOUR() array
84 .Q:'$D(HOUR(HR))
85 .; hour & second
86 .S TIME=$E($P(DATE,".",2),1,4) Q:'TIME
87 .; insert colon (:) between hour & second
88 .S TIME=$E(TIME,1,2)_":"_$E(TIME,3,4)
89 .; date without time
90 .S DATE1=$P(DATE,".")
91 .S IEN=0
92 .F S IEN=$O(@GBL@(DATE,IEN)) Q:'IEN D
93 ..Q:'$D(^KMPD(8973.2,IEN,0)) S DATA=^(0) Q:DATA=""
94 ..S DOT=DOT+1 W:'QUEUED&('(DOT#1000)) "."
95 ..S DELTA=$P(DATA,U,4)
96 ..; quit if delta is less than threshold
97 ..Q:DELTA<KMPDTSEC
98 ..S ^TMP($J,DATE1,TIME)=DATA
99 ..; new person - external format
100 ..S $P(^TMP($J,DATE1,TIME),U,5)=$P($G(^VA(200,+$P(DATA,U,5),0)),U)
101 ;
102 Q
103 ;
104PRINT ;-- print data
105 ;
106 U IO
107 D HDR
108 Q:'$D(^TMP($J))
109 N CONT,DATE,I,TOTAL
110 S DATE="",CONT=1,TOTAL=0
111 F S DATE=$O(^TMP($J,DATE)) Q:'DATE D Q:'CONT
112 .W !,$$FMTE^XLFDT(DATE,2) S HR=""
113 .F S HR=$O(^TMP($J,DATE,HR)) Q:HR="" D Q:'CONT
114 ..I $Y>(IOSL-4) D Q:'CONT
115 ...D CONTINUE^KMPDUTL4("",1,.CONT) Q:'CONT
116 ...D HDR W !,$$FMTE^XLFDT(DATE,2)
117 ..W ?10,HR
118 ..S DATA=^TMP($J,DATE,HR),TOTAL=TOTAL+1
119 ..; user name
120 ..W ?16,$S($P(DATA,U,5)]"":$E($P(DATA,U,5),1,15),1:"N/A")
121 ..; client name
122 ..W ?33,$S($P(DATA,U,6)]"":$E($P(DATA,U,6),1,15),1:"N/A")
123 ..; ip address
124 ..W ?50,$S($P(DATA,U,9)]"":$P(DATA,U,9),1:"N/A")
125 ..; server delta
126 ..W ?67,$J($P(DATA,U,4),8)
127 ..W ! W:$E($O(^TMP($J,DATE,HR)),1,2)'=$E(HR,1,2) !
128 ;
129 ;I TOTAL W !!?3,"Total Count: ",$J($FN(TOTAL,",",0),$L(TOTAL)+1)
130 ;
131 ; pause if output to terminal
132 I CONT D CONTINUE^KMPDUTL4("Press RETURN to continue",1)
133 ;
134 Q
135 ;
136HDR ;-- print header
137 W @IOF
138 S X=$G(KMPDTTL)
139 W !?(80-$L(X)\2),X
140 S X=$G(KMPDATE(0)),X=$P(X,U,3)_" - "_$P(X,U,4)
141 W !?(80-$L(X)\2),X,?61,"Printed: ",$$FMTE^XLFDT(DT,2)
142 S X=$P($G(KMPDSRCH),U,2)_": "
143 S X=X_$P($G(KMPDSRCH(1)),U,$S((+$G(KMPDSRCH))=1:2,1:1))
144 W !?(80-$L(X)\2),X
145 S X="Threshold: "_$G(KMPDTSEC)_" seconds"
146 W !?(80-$L(X)\2),X
147 W !
148 W !,"Date",?10,"Time",?16,"User Name",?33,"Client Name",?50,"IP Address",?67,"Time-to-Load"
149 W !,$$REPEAT^XLFSTR("-",IOM)
150 ;
151 Q
152 ;
153EXIT ;-- cleanup on exit
154 S:$D(ZTQUEUED) ZTREQ="@"
155 D ^%ZISC
156 K KMPDATE,KMPDSRCH,KMPDTSEC,KMPDTTL
157 Q
158 ;
159GLOBAL(KMPDSRCH) ;-- extrinsic function
160 ;-----------------------------------------------------------------------
161 ; KMPDSRCH... see above
162 ;-----------------------------------------------------------------------
163 Q:'$G(KMPDSRCH) ""
164 N GLOBAL,TYPE
165 S GLOBAL=""
166 S TYPE=+$G(KMPDSRCH)
167 Q:'TYPE ""
168 ; username
169 I TYPE=1 S GLOBAL=$NA(^KMPD(8973.2,"ASSNPDTTM","ORWCV",$P(KMPDSRCH(1),U)))
170 ; client name
171 I TYPE=2 S GLOBAL=$NA(^KMPD(8973.2,"ASSCLDTTM","ORWCV",KMPDSRCH(1)))
172 ; ip address
173 I TYPE=3 S GLOBAL=$NA(^KMPD(8973.2,"ASSIPDTTM","ORWCV",KMPDSRCH(1)))
174 ; any occurrence
175 I TYPE=4 S GLOBAL=$NA(^KMPD(8973.2,"ASSDTTM","ORWCV"))
176 Q GLOBAL
Note: See TracBrowser for help on using the repository browser.