KMPDTP2 ;OAK/RAK/JML - CP Timing Daily Time-to-Load Detail ;9/1/2015
;;3.0;Capacity Management Tools;**3**;Jan 15, 2013;Build 42
;
EN ;-- entry point
N KMPDATE,KMPDBIDX,KMPDFGBG,KMPDSSCR,KMPDTOT,KMPDPTNP,KMPDSUB,KMPDTTL,POP,X,Y,ZTDESC,ZTRTN,ZTSAVE,ZTSK,%ZIS
N KMPDLBG,KMPDLFG,KMPDDTSS
S KMPDTTL=" Daily Coversheet Time-to-Load (TTL) Detailed Report "
D HDR^KMPDUTL4(KMPDTTL)
W !
W !?7,"This detailed report displays daily time-to-load values for the"
W !?7,"coversheet at this site. The report breaks the time-to-load"
W !?7,"metrics into ten second groupings."
W !
;
; if no data
I '$O(^KMPD(8973.2,0)) D Q
.W !!?7,"*** There is currently no data in file #8973.2 (CP TIMING) ***"
;
; select date range - first determine which subscript to use in API due to addition of foreground processing
S KMPDLFG=$O(^KMPD(8973.2,"ASSDTTM","ORWCV-FT","A"),-1)
S KMPDLBG=$O(^KMPD(8973.2,"ASSDTTM","ORWCV","A"),-1)
S KMPDDTSS=$S(KMPDLFG=KMPDLBG:"ORWCV-FT",KMPDLFG>KMPDLBG:"ORWCV-FT",KMPDLFG<KMPDLBG:"ORWCV",1:"UNKNOWN")
D DATERNG^KMPDTU10(KMPDDTSS,1,.KMPDATE)
Q:$G(KMPDATE(0))=""
;
; select time frame
S KMPDPTNP=$$PTNPSEL^KMPDUTL4
Q:'KMPDPTNP
;
; select output device.
S %ZIS="Q",%ZIS("A")="Device: ",%ZIS("B")="HOME"
W ! D ^%ZIS I POP W !,"No action taken." Q
; if queued.
I $D(IO("Q")) K IO("Q") D Q
.S ZTDESC=KMPDTTL
.S ZTRTN="EN1^KMPDTP2"
.S ZTSAVE("KMPDATE(")="",ZTSAVE("KMPDPTNP")="",ZTSAVE("KMPDTTL")=""
.D ^%ZTLOAD W:$G(ZTSK) !,"Task #",ZTSK
.D EXIT
;
; if output to terminal display message.
W:$E(IOST,1,2)="C-" !,"Compiling timing stats..."
D EN1
;
Q
;
EN1 ;-- entry point from taskman
Q:'$D(KMPDATE)
Q:'$G(KMPDPTNP)
;
K ^TMP($J)
D DATA,PRINT,EXIT
K ^TMP($J)
;
Q
;
DATA ;-- compile data
Q:'$D(KMPDATE)
Q:'$G(KMPDPTNP)
;
N DATA,DATE,DELTA,DOT,END,I,IEN,PTNP,QUEUED,TOTAL
;
S QUEUED=$D(ZTQUEUED),DOT=1
;
S KMPDTOT("ORWCV")=0,KMPDTOT("ORWCV-FT")=0
S PTNP=+KMPDPTNP
Q:'PTNP
; Loop data - combine Foreground and Background timings
F KMPDSUB="ORWCV","ORWCV-FT" D
.S DATE=$P(KMPDATE(0),U)-.1,END=$P(KMPDATE(0),U,2)
.Q:'DATE!('END)
.F S DATE=$O(^KMPD(8973.2,"ASSDTPT",KMPDSUB,DATE)) Q:'DATE!(DATE>END) D
..S (IEN,TOTAL)=0,^TMP($J,"DATA",DATE)="",^TMP($J,"RPT",DATE)="",TOTAL(KMPDSUB)=0
..F S IEN=$O(^KMPD(8973.2,"ASSDTPT",KMPDSUB,DATE,PTNP,IEN)) Q:'IEN D
...Q:'$D(^KMPD(8973.2,IEN,0))
...S DATA=^KMPD(8973.2,IEN,0)
...S KMPDBIDX=$P(DATA,U),KMPDSSCR=$P(DATA,U,7)
...S ^TMP($J,"DATA",DATE,KMPDBIDX,KMPDSSCR)=$P(DATA,U,4)
...S KMPDTOT(KMPDSSCR)=KMPDTOT(KMPDSSCR)+1
;
; Print combined timings
S DATE=""
F S DATE=$O(^TMP($J,"DATA",DATE)) Q:DATE="" D
.S KMPDBIDX=""
.F S KMPDBIDX=$O(^TMP($J,"DATA",DATE,KMPDBIDX)) Q:KMPDBIDX="" D
..S DELTA=""
..S KMPDSUB=""
..F S KMPDSUB=$O(^TMP($J,"DATA",DATE,KMPDBIDX,KMPDSUB)) Q:KMPDSUB="" D
...S DELTA=DELTA+^TMP($J,"DATA",DATE,KMPDBIDX,KMPDSUB)
..S DOT=DOT+1 W:'QUEUED&('(DOT#1000)) "."
..;
..; if delta is null increment by 1 and quit
..I DELTA="" S $P(^TMP($J,"RPT",DATE),U,50)=$P(^TMP($J,"RPT",DATE),U,50)+1 Q
..; total
..S TOTAL=TOTAL+1
..;
..; loop - less than I*10 seconds
..F I=1:1:9 I DELTA<(I*10) S $P(^TMP($J,"RPT",DATE),U,I)=$P(^TMP($J,"RPT",DATE),U,I)+1 Q
..; 90 or greater seconds
..I DELTA>89 S $P(^TMP($J,"RPT",DATE),U,10)=$P($G(^TMP($J,"RPT",DATE)),U,10)+1
..;
..; back to DATE level
..; determine percentage
.I TOTAL F I=1:1:10 D
..S $P(^TMP($J,"RPT",DATE,1),U,I)=$FN($P(^TMP($J,"RPT",DATE),U,I)/TOTAL*100,"",1)
;
Q
;
PRINT ;-- print data
U IO
D HDR
Q:'$D(^TMP($J))
;
N CONT,DATE,I,TOTAL
;
S DATE="",CONT=1
F S DATE=$O(^TMP($J,"RPT",DATE)) Q:'DATE D Q:'CONT
.S TOTAL=""
.S DATA=^TMP($J,"RPT",DATE),DATA(1)=$G(^TMP($J,"RPT",DATE,1))
.W !,$$FMTE^XLFDT(DATE,2)
.; if no data
.I DATA="" W ?12,"<No Data for ",$P(KMPDPTNP,U,2),">",! Q
.; display data
.F I=1:1:10 D
..W ?12
..I I<10 W $J(I-1*10,2)," to <",I*10
..E W "90 or greater"
..W ?28,$J($FN($P(DATA,U,I),",",0),10)
..; percentages
..W ?44,$J($FN($P(DATA(1),U,I),"",1),10),"%",!
..; totals
..S $P(TOTAL,U)=$P(TOTAL,U)+$P(DATA,U,I)
..S $P(TOTAL,U,2)=$P(TOTAL,U,2)+$P(DATA(1),U,I)
.;
.; back to DATE level
.; totals
.W ?28,"----------",?44,"----------"
.W !?28,$J($FN($P(TOTAL,U),",",0),10)
.W ?44,$J($FN($P(TOTAL,U,2),"",0),10),"%"
.W !!?12,"Incomplete",?28,$J($FN($P(DATA,U,50),",",0),10)
.; page feed if another date
.I $O(^TMP($J,"RPT",DATE)) D
..D CONTINUE^KMPDUTL4("",1,.CONT) Q:'CONT
..D HDR
;
I CONT D
.; legend
.S KMPDFGBG=0
.I KMPDTOT("ORWCV")>0 S KMPDFGBG=1
.I KMPDTOT("ORWCV-FT")>0 S KMPDFGBG=KMPDFGBG+2
.W !!?2,"CV = Coversheet",?30,"Coversheet sections run in:"
.W !?2,"TTL = Time-to-Load"
.W ?30,$S(KMPDFGBG=1:"Background Only",KMPDFGBG=2:"Foreground Only",KMPDFGBG=3:"Both Foreground and Background",1:"Unknown")
.; pause if output to terminal
.D CONTINUE^KMPDUTL4("Press RETURN to continue",1)
;
Q
;
HDR ;-- print header
W @IOF
S X=$G(KMPDTTL)
W !?(80-$L(X)\2),X
S X=$P($G(KMPDPTNP),U,2)
W !?(80-$L(X)\2),X
S X=$G(KMPDATE(0)),X=$P(X,U,3)_" - "_$P(X,U,4)
W !?(80-$L(X)\2),X,?61,"Printed: ",$$FMTE^XLFDT(DT,2)
W !
W !,"Date",?12,"TTL Seconds",?28,"# of CV Loads",?44,"CV Percent"
W !,$$REPEAT^XLFSTR("-",IOM)
;
Q
;
EXIT ;-- cleanup on exit
S:$D(ZTQUEUED) ZTREQ="@"
D ^%ZISC
K KMPDATE,KMPDPTNP,KMPDTTL
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HKMPDTP2 5473 printed Dec 13, 2024@01:40:46 Page 2
KMPDTP2 ;OAK/RAK/JML - CP Timing Daily Time-to-Load Detail ;9/1/2015
+1 ;;3.0;Capacity Management Tools;**3**;Jan 15, 2013;Build 42
+2 ;
EN ;-- entry point
+1 NEW KMPDATE,KMPDBIDX,KMPDFGBG,KMPDSSCR,KMPDTOT,KMPDPTNP,KMPDSUB,KMPDTTL,POP,X,Y,ZTDESC,ZTRTN,ZTSAVE,ZTSK,%ZIS
+2 NEW KMPDLBG,KMPDLFG,KMPDDTSS
+3 SET KMPDTTL=" Daily Coversheet Time-to-Load (TTL) Detailed Report "
+4 DO HDR^KMPDUTL4(KMPDTTL)
+5 WRITE !
+6 WRITE !?7,"This detailed report displays daily time-to-load values for the"
+7 WRITE !?7,"coversheet at this site. The report breaks the time-to-load"
+8 WRITE !?7,"metrics into ten second groupings."
+9 WRITE !
+10 ;
+11 ; if no data
+12 IF '$ORDER(^KMPD(8973.2,0))
Begin DoDot:1
+13 WRITE !!?7,"*** There is currently no data in file #8973.2 (CP TIMING) ***"
End DoDot:1
QUIT
+14 ;
+15 ; select date range - first determine which subscript to use in API due to addition of foreground processing
+16 SET KMPDLFG=$ORDER(^KMPD(8973.2,"ASSDTTM","ORWCV-FT","A"),-1)
+17 SET KMPDLBG=$ORDER(^KMPD(8973.2,"ASSDTTM","ORWCV","A"),-1)
+18 SET KMPDDTSS=$SELECT(KMPDLFG=KMPDLBG:"ORWCV-FT",KMPDLFG>KMPDLBG:"ORWCV-FT",KMPDLFG<KMPDLBG:"ORWCV",1:"UNKNOWN")
+19 DO DATERNG^KMPDTU10(KMPDDTSS,1,.KMPDATE)
+20 if $GET(KMPDATE(0))=""
QUIT
+21 ;
+22 ; select time frame
+23 SET KMPDPTNP=$$PTNPSEL^KMPDUTL4
+24 if 'KMPDPTNP
QUIT
+25 ;
+26 ; select output device.
+27 SET %ZIS="Q"
SET %ZIS("A")="Device: "
SET %ZIS("B")="HOME"
+28 WRITE !
DO ^%ZIS
IF POP
WRITE !,"No action taken."
QUIT
+29 ; if queued.
+30 IF $DATA(IO("Q"))
KILL IO("Q")
Begin DoDot:1
+31 SET ZTDESC=KMPDTTL
+32 SET ZTRTN="EN1^KMPDTP2"
+33 SET ZTSAVE("KMPDATE(")=""
SET ZTSAVE("KMPDPTNP")=""
SET ZTSAVE("KMPDTTL")=""
+34 DO ^%ZTLOAD
if $GET(ZTSK)
WRITE !,"Task #",ZTSK
+35 DO EXIT
End DoDot:1
QUIT
+36 ;
+37 ; if output to terminal display message.
+38 if $EXTRACT(IOST,1,2)="C-"
WRITE !,"Compiling timing stats..."
+39 DO EN1
+40 ;
+41 QUIT
+42 ;
EN1 ;-- entry point from taskman
+1 if '$DATA(KMPDATE)
QUIT
+2 if '$GET(KMPDPTNP)
QUIT
+3 ;
+4 KILL ^TMP($JOB)
+5 DO DATA
DO PRINT
DO EXIT
+6 KILL ^TMP($JOB)
+7 ;
+8 QUIT
+9 ;
DATA ;-- compile data
+1 if '$DATA(KMPDATE)
QUIT
+2 if '$GET(KMPDPTNP)
QUIT
+3 ;
+4 NEW DATA,DATE,DELTA,DOT,END,I,IEN,PTNP,QUEUED,TOTAL
+5 ;
+6 SET QUEUED=$DATA(ZTQUEUED)
SET DOT=1
+7 ;
+8 SET KMPDTOT("ORWCV")=0
SET KMPDTOT("ORWCV-FT")=0
+9 SET PTNP=+KMPDPTNP
+10 if 'PTNP
QUIT
+11 ; Loop data - combine Foreground and Background timings
+12 FOR KMPDSUB="ORWCV","ORWCV-FT"
Begin DoDot:1
+13 SET DATE=$PIECE(KMPDATE(0),U)-.1
SET END=$PIECE(KMPDATE(0),U,2)
+14 if 'DATE!('END)
QUIT
+15 FOR
SET DATE=$ORDER(^KMPD(8973.2,"ASSDTPT",KMPDSUB,DATE))
if 'DATE!(DATE>END)
QUIT
Begin DoDot:2
+16 SET (IEN,TOTAL)=0
SET ^TMP($JOB,"DATA",DATE)=""
SET ^TMP($JOB,"RPT",DATE)=""
SET TOTAL(KMPDSUB)=0
+17 FOR
SET IEN=$ORDER(^KMPD(8973.2,"ASSDTPT",KMPDSUB,DATE,PTNP,IEN))
if 'IEN
QUIT
Begin DoDot:3
+18 if '$DATA(^KMPD(8973.2,IEN,0))
QUIT
+19 SET DATA=^KMPD(8973.2,IEN,0)
+20 SET KMPDBIDX=$PIECE(DATA,U)
SET KMPDSSCR=$PIECE(DATA,U,7)
+21 SET ^TMP($JOB,"DATA",DATE,KMPDBIDX,KMPDSSCR)=$PIECE(DATA,U,4)
+22 SET KMPDTOT(KMPDSSCR)=KMPDTOT(KMPDSSCR)+1
End DoDot:3
End DoDot:2
End DoDot:1
+23 ;
+24 ; Print combined timings
+25 SET DATE=""
+26 FOR
SET DATE=$ORDER(^TMP($JOB,"DATA",DATE))
if DATE=""
QUIT
Begin DoDot:1
+27 SET KMPDBIDX=""
+28 FOR
SET KMPDBIDX=$ORDER(^TMP($JOB,"DATA",DATE,KMPDBIDX))
if KMPDBIDX=""
QUIT
Begin DoDot:2
+29 SET DELTA=""
+30 SET KMPDSUB=""
+31 FOR
SET KMPDSUB=$ORDER(^TMP($JOB,"DATA",DATE,KMPDBIDX,KMPDSUB))
if KMPDSUB=""
QUIT
Begin DoDot:3
+32 SET DELTA=DELTA+^TMP($JOB,"DATA",DATE,KMPDBIDX,KMPDSUB)
End DoDot:3
+33 SET DOT=DOT+1
if 'QUEUED&('(DOT#1000))
WRITE "."
+34 ;
+35 ; if delta is null increment by 1 and quit
+36 IF DELTA=""
SET $PIECE(^TMP($JOB,"RPT",DATE),U,50)=$PIECE(^TMP($JOB,"RPT",DATE),U,50)+1
QUIT
+37 ; total
+38 SET TOTAL=TOTAL+1
+39 ;
+40 ; loop - less than I*10 seconds
+41 FOR I=1:1:9
IF DELTA<(I*10)
SET $PIECE(^TMP($JOB,"RPT",DATE),U,I)=$PIECE(^TMP($JOB,"RPT",DATE),U,I)+1
QUIT
+42 ; 90 or greater seconds
+43 IF DELTA>89
SET $PIECE(^TMP($JOB,"RPT",DATE),U,10)=$PIECE($GET(^TMP($JOB,"RPT",DATE)),U,10)+1
+44 ;
+45 ; back to DATE level
+46 ; determine percentage
End DoDot:2
+47 IF TOTAL
FOR I=1:1:10
Begin DoDot:2
+48 SET $PIECE(^TMP($JOB,"RPT",DATE,1),U,I)=$FNUMBER($PIECE(^TMP($JOB,"RPT",DATE),U,I)/TOTAL*100,"",1)
End DoDot:2
End DoDot:1
+49 ;
+50 QUIT
+51 ;
PRINT ;-- print data
+1 USE IO
+2 DO HDR
+3 if '$DATA(^TMP($JOB))
QUIT
+4 ;
+5 NEW CONT,DATE,I,TOTAL
+6 ;
+7 SET DATE=""
SET CONT=1
+8 FOR
SET DATE=$ORDER(^TMP($JOB,"RPT",DATE))
if 'DATE
QUIT
Begin DoDot:1
+9 SET TOTAL=""
+10 SET DATA=^TMP($JOB,"RPT",DATE)
SET DATA(1)=$GET(^TMP($JOB,"RPT",DATE,1))
+11 WRITE !,$$FMTE^XLFDT(DATE,2)
+12 ; if no data
+13 IF DATA=""
WRITE ?12,"<No Data for ",$PIECE(KMPDPTNP,U,2),">",!
QUIT
+14 ; display data
+15 FOR I=1:1:10
Begin DoDot:2
+16 WRITE ?12
+17 IF I<10
WRITE $JUSTIFY(I-1*10,2)," to <",I*10
+18 IF '$TEST
WRITE "90 or greater"
+19 WRITE ?28,$JUSTIFY($FNUMBER($PIECE(DATA,U,I),",",0),10)
+20 ; percentages
+21 WRITE ?44,$JUSTIFY($FNUMBER($PIECE(DATA(1),U,I),"",1),10),"%",!
+22 ; totals
+23 SET $PIECE(TOTAL,U)=$PIECE(TOTAL,U)+$PIECE(DATA,U,I)
+24 SET $PIECE(TOTAL,U,2)=$PIECE(TOTAL,U,2)+$PIECE(DATA(1),U,I)
End DoDot:2
+25 ;
+26 ; back to DATE level
+27 ; totals
+28 WRITE ?28,"----------",?44,"----------"
+29 WRITE !?28,$JUSTIFY($FNUMBER($PIECE(TOTAL,U),",",0),10)
+30 WRITE ?44,$JUSTIFY($FNUMBER($PIECE(TOTAL,U,2),"",0),10),"%"
+31 WRITE !!?12,"Incomplete",?28,$JUSTIFY($FNUMBER($PIECE(DATA,U,50),",",0),10)
+32 ; page feed if another date
+33 IF $ORDER(^TMP($JOB,"RPT",DATE))
Begin DoDot:2
+34 DO CONTINUE^KMPDUTL4("",1,.CONT)
if 'CONT
QUIT
+35 DO HDR
End DoDot:2
End DoDot:1
if 'CONT
QUIT
+36 ;
+37 IF CONT
Begin DoDot:1
+38 ; legend
+39 SET KMPDFGBG=0
+40 IF KMPDTOT("ORWCV")>0
SET KMPDFGBG=1
+41 IF KMPDTOT("ORWCV-FT")>0
SET KMPDFGBG=KMPDFGBG+2
+42 WRITE !!?2,"CV = Coversheet",?30,"Coversheet sections run in:"
+43 WRITE !?2,"TTL = Time-to-Load"
+44 WRITE ?30,$SELECT(KMPDFGBG=1:"Background Only",KMPDFGBG=2:"Foreground Only",KMPDFGBG=3:"Both Foreground and Background",1:"Unknown")
+45 ; pause if output to terminal
+46 DO CONTINUE^KMPDUTL4("Press RETURN to continue",1)
End DoDot:1
+47 ;
+48 QUIT
+49 ;
HDR ;-- print header
+1 WRITE @IOF
+2 SET X=$GET(KMPDTTL)
+3 WRITE !?(80-$LENGTH(X)\2),X
+4 SET X=$PIECE($GET(KMPDPTNP),U,2)
+5 WRITE !?(80-$LENGTH(X)\2),X
+6 SET X=$GET(KMPDATE(0))
SET X=$PIECE(X,U,3)_" - "_$PIECE(X,U,4)
+7 WRITE !?(80-$LENGTH(X)\2),X,?61,"Printed: ",$$FMTE^XLFDT(DT,2)
+8 WRITE !
+9 WRITE !,"Date",?12,"TTL Seconds",?28,"# of CV Loads",?44,"CV Percent"
+10 WRITE !,$$REPEAT^XLFSTR("-",IOM)
+11 ;
+12 QUIT
+13 ;
EXIT ;-- cleanup on exit
+1 if $DATA(ZTQUEUED)
SET ZTREQ="@"
+2 DO ^%ZISC
+3 KILL KMPDATE,KMPDPTNP,KMPDTTL
+4 QUIT