source: WorldVistAEHR/trunk/r/CAPACITY_MANAGEMENT_TOOLS-KMPD-KMPL/KMPDTP3.m@ 1639

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

initial load of WorldVistAEHR

File size: 3.8 KB
RevLine 
[613]1KMPDTP3 ;OAK/RAK - CP Timing Hourly Time-to-Load ;6/21/05 10:14
2 ;;2.0;CAPACITY MANAGEMENT TOOLS;**4**;Mar 22, 2002
3 ;
4EN ;-- entry point
5 N KMPDATE,KMPDTTL,POP,X,Y,ZTDESC,ZTRTN,ZTRSAVE,%ZIS
6 S KMPDTTL=" 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(^KMPD(8973.2,0)) D Q
15 .W !!?7,"*** There is currently no data in file #8973.2 (CP TIMING) ***"
16 ;
17 D DATERNG^KMPDTU10("ORWCV",1,.KMPDATE)
18 Q:$G(KMPDATE(0))=""
19 ; select output device.
20 S %ZIS="Q",%ZIS("A")="Device: ",%ZIS("B")="HOME"
21 W ! D ^%ZIS I POP W !,"No action taken." Q
22 ; if queued.
23 I $D(IO("Q")) K IO("Q") D Q
24 .S ZTDESC=KMPDTTL
25 .S ZTRTN="EN1^KMPDTP3"
26 .S ZTSAVE("KMPDATE(")="",ZTSAVE("KMPDTTL")=""
27 .D ^%ZTLOAD W:$G(ZTSK) !,"Task #",ZTSK
28 .D EXIT
29 ;
30 ; if output to terminal display message.
31 W:$E(IOST,1,2)="C-" !,"Compiling timing stats..."
32 D EN1
33 ;
34 Q
35 ;
36EN1 ;-- entry point from taskman
37 Q:'$D(KMPDATE)
38 K ^TMP($J)
39 D DATA,PRINT,EXIT
40 K ^TMP($J)
41 Q
42 ;
43DATA ;-- compile data
44 Q:'$D(KMPDATE)
45 N DATA,DATE,DELTA,DOT,END,HR,I,IEN,PTNP,QUEUED,TOTAL
46 S DATE=$P(KMPDATE(0),U)-.1,END=$P(KMPDATE(0),U,2)
47 Q:'DATE!('END)
48 S DOT=1,QUEUED=$D(ZTQUEUED)
49 F S DATE=$O(^KMPD(8973.2,"ASVDTSS","ORWCV",DATE)) Q:'DATE!(DATE>END) D
50 .S (IEN,TOTAL)=0
51 .; array with hours
52 .F I=0:1:23 S ^TMP($J,DATE,I)=""
53 .F S IEN=$O(^KMPD(8973.2,"ASVDTSS","ORWCV",DATE,IEN)) Q:'IEN D
54 ..Q:'$D(^KMPD(8973.2,IEN,0)) S DATA=^(0) Q:DATA=""
55 ..S DOT=DOT+1 W:'QUEUED&('(DOT#1000)) "."
56 ..; get delta and hour
57 ..S DELTA=$P(DATA,U,4),HR=+$E($P($P(DATA,U,3),".",2),1,2)
58 ..S HR=$S(HR="":0,HR=24:0,1:HR)
59 ..; if delta
60 ..I $P(DATA,U,4)'="" D
61 ...; minimum delta
62 ...I $P(^TMP($J,DATE,HR),U,2)=""!($P(DATA,U,4)<$P(^TMP($J,DATE,HR),U,2)) D
63 ....S $P(^TMP($J,DATE,HR),U,2)=$P(DATA,U,4)
64 ...; maximum delta
65 ...I $P(DATA,U,4)>$P(^TMP($J,DATE,HR),U,3) S $P(^TMP($J,DATE,HR),U,3)=$P(DATA,U,4)
66 ...; total delta
67 ...S $P(^TMP($J,DATE,HR),U,4)=$P(^TMP($J,DATE,HR),U,4)+$P(DATA,U,4)
68 ...; count
69 ...S $P(^TMP($J,DATE,HR),U,5)=$P(^TMP($J,DATE,HR),U,5)+1
70 ..; if no delta
71 ..E S $P(^TMP($J,DATE,HR),U,6)=$P(^TMP($J,DATE,HR),U,6)+1
72 .;
73 .; back to DATE level
74 .; average
75 .F I=0:1:23 I $P(^TMP($J,DATE,I),U,5) D
76 ..S $P(^TMP($J,DATE,I),U)=$P(^TMP($J,DATE,I),U,4)/$P(^TMP($J,DATE,I),U,5)
77 ;
78 Q
79 ;
80PRINT ;-- print data
81 D HDR
82 Q:'$D(^TMP($J))
83 N CONT,DATE,HR,I,TOTAL
84 S DATE="",CONT=1
85 F S DATE=$O(^TMP($J,DATE)) Q:'DATE S HR="" D Q:'CONT
86 .S TOTAL=""
87 .W !,$$FMTE^XLFDT(DATE,2)
88 .F S HR=$O(^TMP($J,DATE,HR)) Q:HR="" D Q:'CONT
89 ..; page feed
90 ..I $Y>(IOSL-3) D CONTINUE^KMPDUTL4("",1,.CONT) Q:'CONT D HDR W !
91 ..W ?12," ",$S($L(HR)=1:"0",1:""),HR
92 ..S DATA=^TMP($J,DATE,HR)
93 ..W ?20,$J($FN($P(DATA,U),",",0),10)
94 ..W ?34,$J($FN($P(DATA,U,2),",",0),10)
95 ..W ?48,$J($FN($P(DATA,U,3),",",0),10)
96 ..W ?62,$J($FN($P(DATA,U,5),",",0),10)
97 ..W !
98 ..S $P(TOTAL,U)=$P(TOTAL,U)+$P(DATA,U,5)
99 ..S $P(TOTAL,U,2)=$P(TOTAL,U,2)+$P(DATA,U,6)
100 .;
101 .; back to DATE level
102 .; totals
103 .W ?62,"----------",!?62,$J($FN(TOTAL,",",0),10),!
104 .W !?12,"Incomplete: ",$J($FN($P(TOTAL,U,2),",",0),$L($P(TOTAL,U,2))+2),!
105 .; if another date
106 .I $O(^TMP($J,DATE)) D CONTINUE^KMPDUTL4("",1,.CONT) Q:'CONT D HDR W !
107 ;
108 I CONT D
109 .; legend
110 .W !!?2,"CV = Coversheet",!?2,"TTL = Time-to-Load"
111 .; pause if output to terminal
112 .D CONTINUE^KMPDUTL4("Press RETURN to continue",1)
113 ;
114 Q
115 ;
116HDR ;-- print header
117 W @IOF
118 S X=$G(KMPDTTL)
119 W !?(80-$L(X)\2),X
120 S X=$G(KMPDATE(0)),X=$P(X,U,3)_" - "_$P(X,U,4)
121 W !?(80-$L(X)\2),X,?61,"Printed: ",$$FMTE^XLFDT(DT,2)
122 W !
123 W !?20,"|---------------Seconds---------------|"
124 W !,"Date",?12,"Hour",?20,"TTL Average",?34,"TTL Minimum",?48,"TTL Maximum",?62,"# of CV Loads"
125 W !,$$REPEAT^XLFSTR("-",IOM)
126 ;
127 Q
128 ;
129EXIT ;-- cleanup on exit
130 S:$D(ZTQUEUED) ZTREQ="@"
131 D ^%ZISC
132 K KMPDATE,KMPDTTL
133 Q
Note: See TracBrowser for help on using the repository browser.