source: WorldVistAEHR/trunk/r/CAPACITY_MANAGEMENT_TOOLS-KMPD-KMPL/KMPDTP4.m@ 1036

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

initial load of WorldVistAEHR

File size: 4.5 KB
Line 
1KMPDTP4 ;OAK/RAK - CP Timing Hourly Time-to-Load ;2/17/04 09:38
2 ;;2.0;CAPACITY MANAGEMENT TOOLS;**4**;Mar 22, 2002
3 ;
4EN ;-- entry point
5 ;
6 N KMPDATE,KMPDTTL,POP,X,Y,ZTDESC,ZTRTN,ZTRSAVE,ZTSK,%ZIS
7 ;
8 S KMPDTTL=" Hourly Coversheet Time-to-Load (TTL) Detail Report "
9 D HDR^KMPDUTL4(KMPDTTL)
10 W !
11 W !?7,"This detail report displays the hourly time-to-load values"
12 W !?7,"for the coversheet at this site. The report breaks the"
13 W !?7,"time-to-load metrics into ten second groupings."
14 W !
15 ;
16 ; if no data
17 I '$O(^KMPD(8973.2,0)) D Q
18 .W !!?7,"*** There is currently no data in file #8973.2 (CP TIMING) ***"
19 ;
20 ; date & hour(s)
21 D DTTMRNG^KMPDTU10("ORWCV",1,.KMPDATE,8)
22 Q:$G(KMPDATE(0))=""
23 Q:$G(KMPDATE(1))=""
24 ;
25 ; select output device.
26 S %ZIS="Q",%ZIS("A")="Device: ",%ZIS("B")="HOME"
27 W ! D ^%ZIS I POP W !,"No action taken." Q
28 ; if queued.
29 I $D(IO("Q")) K IO("Q") D Q
30 .S ZTDESC=KMPDTTL
31 .S ZTRTN="EN1^KMPDTP4"
32 .S ZTSAVE("KMPDATE(")="",ZTSAVE("KMPDTTL")=""
33 .D ^%ZTLOAD W:$G(ZTSK) !,"Task #",ZTSK
34 .D EXIT
35 ;
36 ; if output to terminal display message.
37 W:$E(IOST,1,2)="C-" !,"Compiling timing stats..."
38 D EN1
39 ;
40 Q
41 ;
42EN1 ;-- entry point from taskman
43 Q:'$D(KMPDATE)
44 K ^TMP($J)
45 D DATA,PRINT,EXIT
46 K ^TMP($J)
47 Q
48 ;
49DATA ;-- compile data
50 ;
51 Q:'$D(KMPDATE)
52 ;
53 N DATA,DATE,DATE1,DELTA,DOT,END,HOUR,HR,I,IEN,PTNP,QUEUED,TOTAL
54 ;
55 S DOT=1,QUEUED=$D(ZTQUEUED)
56 ; set up HOUR() array
57 F I=1:1:24 S:$P(KMPDATE(1),",",I)'="" HOUR(+$P(KMPDATE(1),",",I))=""
58 Q:'$D(HOUR)
59 S DATE=$P(KMPDATE(0),U)-.1,END=$P(KMPDATE(0),U,2)+.9
60 Q:'DATE!('END)
61 F S DATE=$O(^KMPD(8973.2,"ASSDTTM","ORWCV",DATE)) Q:'DATE!(DATE>END) D
62 .; date without time
63 .S DATE1=$P(DATE,".")
64 .; set up HOUR() array
65 .M:'$D(^TMP($J,DATE1)) ^TMP($J,DATE1)=HOUR
66 .; set up TOTAL() array
67 .M:'$D(TOTAL(DATE1)) TOTAL(DATE1)=HOUR
68 .S IEN=0
69 .F S IEN=$O(^KMPD(8973.2,"ASSDTTM","ORWCV",DATE,IEN)) Q:'IEN D
70 ..S HR=+$E($P(DATE,".",2),1,2) S:HR="" HR="0"
71 ..Q:'$D(HOUR(HR))
72 ..Q:'$D(^KMPD(8973.2,IEN,0)) S DATA=^(0) Q:DATA=""
73 ..S DOT=DOT+1 W:'QUEUED&('(DOT#1000)) "."
74 ..S DELTA=$P(DATA,U,4)
75 ..; if delta is null increment by 1 and quit
76 ..I DELTA="" S $P(^TMP($J,DATE1,HR),U,50)=$P(^TMP($J,DATE1,HR),U,50)+1 Q
77 ..; total
78 ..S TOTAL(DATE1,HR)=TOTAL(DATE1,HR)+1
79 ..;
80 ..;
81 ..; loop - less than I*10 seconds
82 ..F I=1:1:9 I DELTA<(I*10) S $P(^TMP($J,DATE1,HR),U,I)=$P(^TMP($J,DATE1,HR),U,I)+1 Q
83 ..; 90 or greater seconds
84 ..I DELTA>89 S $P(^TMP($J,DATE1,HR),U,10)=$P(^TMP($J,DATE1,HR),U,10)+1
85 ;
86 ; determine percentage
87 S DATE1=0
88 F S DATE1=$O(TOTAL(DATE1)) Q:'DATE1 S HR="" D
89 .F S HR=$O(TOTAL(DATE1,HR)) Q:HR="" I TOTAL(DATE1,HR) F I=1:1:10 D
90 ..S $P(^TMP($J,DATE1,HR,1),U,I)=$FN($P(^TMP($J,DATE1,HR),U,I)/TOTAL(DATE1,HR)*100,"",1)
91 ;
92 Q
93 ;
94PRINT ;-- print data
95 ;
96 U IO
97 D HDR
98 Q:'$D(^TMP($J))
99 N CONT,DATE,I,TOTAL
100 S DATE="",CONT=1
101 F S DATE=$O(^TMP($J,DATE)) Q:'DATE D Q:'CONT
102 .W !,$$FMTE^XLFDT(DATE,2) S HR=""
103 .F S HR=$O(^TMP($J,DATE,HR)) Q:HR="" D Q:'CONT
104 ..I $Y>(IOSL-9) D Q:'CONT
105 ...D CONTINUE^KMPDUTL4("",1,.CONT) Q:'CONT
106 ...D HDR W !,$$FMTE^XLFDT(DATE,2)
107 ..W ?12,HR
108 ..S TOTAL="",DATA=^TMP($J,DATE,HR),DATA(1)=$G(^TMP($J,DATE,HR,1))
109 ..; if no data
110 ..I DATA="" W ?12,"<No Data>",! Q
111 ..; display data
112 ..F I=1:1:9 D
113 ...W ?16,I-1*10," to <",I*10
114 ...W ?32,$J($FN($P(DATA,U,I),",",0),10)
115 ...; percentages
116 ...W ?48,$J($FN($P(DATA(1),U,I),"",1),10),"%"
117 ...W !
118 ...; totals
119 ...S $P(TOTAL,U)=$P(TOTAL,U)+$P(DATA,U,I)
120 ...S $P(TOTAL,U,2)=$P(TOTAL,U,2)+$P(DATA(1),U,I)
121 ..;
122 ..; back to DATE level
123 ..; greater than 90
124 ..W ?16,"90 or greater",?32,$J($FN($P(DATA,U,10),",",0),10)
125 ..W ?48,$J($FN($P(DATA(1),U,10),"",1),10),"%"
126 ..S $P(TOTAL,U)=$P(TOTAL,U)+$P(DATA,U,10)
127 ..S $P(TOTAL,U,2)=$P(TOTAL,U,2)+$P(DATA(1),U,10)
128 ..; totals
129 ..W !?32,"----------",?48,"----------"
130 ..W !?32,$J($FN($P(TOTAL,U),",",0),10)
131 ..W ?48,$J($FN($P(TOTAL,U,2),"",0),10),"%"
132 ..W !?16,"Incomplete",?32,$J($FN($P(DATA,U,50),",",0),10),!
133 ..; page feed if another date
134 ..I $O(^TMP($J,DATE)) D
135 ...D CONTINUE^KMPDUTL4("",1,.CONT) Q:'CONT
136 ...D HDR
137 ..W !
138 ;
139 I CONT D
140 .; legend
141 .W !!?2,"CV = Coversheet",!?2,"TTL = Time-to-Load"
142 .; pause if output to terminal
143 .D CONTINUE^KMPDUTL4("Press RETURN to continue",1)
144 ;
145 Q
146 ;
147HDR ;-- print header
148 W @IOF
149 S X=$G(KMPDTTL)
150 W !?(80-$L(X)\2),X
151 S X=$G(KMPDATE(0)),X=$P(X,U,3)_" - "_$P(X,U,4)
152 W !?(80-$L(X)\2),X,?61,"Printed: ",$$FMTE^XLFDT(DT,2)
153 W !
154 W !,"Date",?12,"Hr",?16,"TTL Seconds",?32,"# CV Loads",?48,"CV Percent"
155 W !,$$REPEAT^XLFSTR("-",IOM)
156 ;
157 Q
158 ;
159EXIT ;-- cleanup on exit
160 S:$D(ZTQUEUED) ZTREQ="@"
161 D ^%ZISC
162 K KMPDATE,KMPDTTL
163 Q
Note: See TracBrowser for help on using the repository browser.