source: FOIAVistA/trunk/r/CAPACITY_MANAGEMENT_TOOLS-KMPD-KMPL/KMPDTP7.m@ 794

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

initial load of FOIAVistA 6/30/08 version

File size: 4.2 KB
Line 
1KMPDTP7 ;OAK/RAK - Real-Time CP Timing Hourly Time-to-Load ;6/21/05 10:15
2 ;;2.0;CAPACITY MANAGEMENT TOOLS;**4**;Mar 22, 2002
3 ;
4EN ;-- entry point
5 N KMPDTTL,POP,X,Y,ZTDESC,ZTRTN,ZTRSAVE,ZTSK,%ZIS
6 S KMPDTTL=" Real-Time Hourly Coversheet Time-to-Load (TTL) Report "
7 D HDR^KMPDUTL4(KMPDTTL)
8 W !
9 W !?7,"This report displays the hourly average time-to-load value"
10 W !?7,"for the coversheet at this site over 24 hours."
11 W !
12 ;
13 ; if no data
14 I $O(^KMPTMP("KMPDT","ORWCV",""))="" D Q
15 .W !!?7,"*** There is currently no data in global ^KMPTMP(""KMPDT"",""ORWCV"") ***"
16 ;
17 ; select output device.
18 S %ZIS="Q",%ZIS("A")="Device: ",%ZIS("B")="HOME"
19 W ! D ^%ZIS I POP W !,"No action taken." Q
20 ; if queued.
21 I $D(IO("Q")) K IO("Q") D Q
22 .S ZTDESC=KMPDTTL
23 .S ZTRTN="EN1^KMPDTP7"
24 .S ZTSAVE("KMPDTTL")=""
25 .D ^%ZTLOAD W:$G(ZTSK) !,"Task #",ZTSK
26 .D EXIT
27 ;
28 ; if output to terminal display message.
29 W:$E(IOST,1,2)="C-" !,"Compiling timing stats..."
30 D EN1
31 ;
32 Q
33 ;
34EN1 ;-- entry point from taskman
35 K ^TMP($J)
36 D DATA,PRINT,EXIT
37 K ^TMP($J)
38 Q
39 ;
40DATA ;-- compile data
41 ;
42 N DATA,DATA1,DATE,DATE1,DELTA,DOT,HOURS,HR,I,QUEUED,TIME
43 ;
44 S DOT=1,QUEUED=$D(ZTQUEUED),DATE=$$DT^XLFDT
45 ; array with hours
46 S HOURS=$$RLTMHR^KMPDTU11(1,0) Q:HOURS=""
47 F I=1:1 Q:$P(HOURS,",",I)="" S ^TMP($J,DATE,$P(HOURS,",",I))=""
48 S I="",TOTAL=0
49 F S I=$O(^KMPTMP("KMPDT","ORWCV",I)) Q:I="" S DATA=^(I) I DATA]"" D
50 .S DOT=DOT+1 W:'QUEUED&('(DOT#1000)) "."
51 .; start/end date/time in fileman format
52 .S DATE(1)=$$HTFM^XLFDT($P(DATA,U)),DATE(2)=$$HTFM^XLFDT($P(DATA,U,2))
53 .Q:'DATE(1)!('DATE(2))
54 .S DELTA=$$FMDIFF^XLFDT(DATE(2),DATE(1),2)
55 .S:DELTA<0 DELTA=""
56 .; determine hour
57 .S HR=+$E($P(DATE(1),".",2),1,2)
58 .S HR=$S(HR="":0,HR=24:0,1:HR)
59 .; quit if not in HOUR() array
60 .;Q:'$D(HOUR(HR))
61 .; hour & second
62 .S TIME=$E($P(DATE(1),".",2),1,4) Q:'TIME
63 .; insert colon (:) between hour & second
64 .S TIME=$E(TIME,1,2)_":"_$E(TIME,3,4)
65 .S:$P(TIME,":",2)="" $P(TIME,":",2)="00"
66 .; date without time
67 .S DATE1=$P(DATE(1),".") Q:'DATE1
68 .S DATA1="^^^"_DELTA_"^"_$P(DATA,U,3)_"^"_$P(DATA,U,4)_"^^^"_$P($P(I," ",2),"-")
69 .;
70 .; if delta
71 .I $P(DATA1,U,4)'="" D
72 ..; minimum delta
73 ..I $P(^TMP($J,DATE,HR),U,2)=""!($P(DATA1,U,4)<$P(^TMP($J,DATE,HR),U,2)) D
74 ...S $P(^TMP($J,DATE,HR),U,2)=$P(DATA1,U,4)
75 ..; maximum delta
76 ..I $P(DATA1,U,4)>$P(^TMP($J,DATE,HR),U,3) S $P(^TMP($J,DATE,HR),U,3)=$P(DATA1,U,4)
77 ..; total delta
78 ..S $P(^TMP($J,DATE,HR),U,4)=$P(^TMP($J,DATE,HR),U,4)+$P(DATA1,U,4)
79 ..; count
80 ..S $P(^TMP($J,DATE,HR),U,5)=$P(^TMP($J,DATE,HR),U,5)+1
81 .; if no delta
82 .E S $P(^TMP($J,DATE,HR),U,6)=$P(^TMP($J,DATE,HR),U,6)+1
83 ;
84 ; average
85 F HR=1:1 S I=$P(HOURS,",",HR) Q:I="" I $P(^TMP($J,DATE,I),U,5) D
86 .S $P(^TMP($J,DATE,I),U)=$P(^TMP($J,DATE,I),U,4)/$P(^TMP($J,DATE,I),U,5)
87 ;
88 Q
89 ;
90PRINT ;-- print data
91 U IO
92 D HDR
93 Q:'$D(^TMP($J))
94 N CONT,DATE,HR,I,TOTAL
95 S DATE="",CONT=1
96 F S DATE=$O(^TMP($J,DATE)) Q:'DATE S HR="" D Q:'CONT
97 .S TOTAL=""
98 .W !,$$FMTE^XLFDT(DATE,2)
99 .F S HR=$O(^TMP($J,DATE,HR)) Q:HR="" D Q:'CONT
100 ..; page feed
101 ..I $Y>(IOSL-3) D CONTINUE^KMPDUTL4("",1,.CONT) Q:'CONT D HDR W !
102 ..W ?12," ",$S($L(HR)=1:"0",1:""),HR
103 ..S DATA=^TMP($J,DATE,HR)
104 ..W ?20,$J($FN($P(DATA,U),",",0),10)
105 ..W ?34,$J($FN($P(DATA,U,2),",",0),10)
106 ..W ?48,$J($FN($P(DATA,U,3),",",0),10)
107 ..W ?62,$J($FN($P(DATA,U,5),",",0),10)
108 ..W !
109 ..S $P(TOTAL,U)=$P(TOTAL,U)+$P(DATA,U,5)
110 ..S $P(TOTAL,U,2)=$P(TOTAL,U,2)+$P(DATA,U,6)
111 .;
112 .; back to DATE level
113 .; totals
114 .W ?62,"----------",!?62,$J($FN(TOTAL,",",0),10),!
115 .W !?12,"Incomplete: ",$J($FN($P(TOTAL,U,2),",",0),$L($P(TOTAL,U,2))+2),!
116 .; if another date
117 .I $O(^TMP($J,DATE)) D CONTINUE^KMPDUTL4("",1,.CONT) Q:'CONT D HDR W !
118 ;
119 I CONT D
120 .; legend
121 .W !!?2,"CV = Coversheet",!?2,"TTL = Time-to-Load"
122 .; pause if output to terminal
123 .D CONTINUE^KMPDUTL4("Press RETURN to continue",1)
124 ;
125 Q
126 ;
127HDR ;-- print header
128 W @IOF
129 S X=$G(KMPDTTL)
130 W !?(80-$L(X)\2),X
131 S X=$$FMTE^XLFDT($$DT^XLFDT)
132 W !?(80-$L(X)\2),X,?61,"Printed: ",$$FMTE^XLFDT(DT,2)
133 W !
134 W !?20,"|---------------Seconds---------------|"
135 W !,"Date",?12,"Hour",?20,"TTL Average",?34,"TTL Minimum",?48,"TTL Maximum",?62,"# of CV Loads"
136 W !,$$REPEAT^XLFSTR("-",IOM)
137 ;
138 Q
139 ;
140EXIT ;-- cleanup on exit
141 S:$D(ZTQUEUED) ZTREQ="@"
142 D ^%ZISC
143 K KMPDTTL
144 Q
Note: See TracBrowser for help on using the repository browser.