KMPDTP1 ;OAK/RAK/JML - CP Timing Time to Load Summary ;9/1/2015
;;3.0;Capacity Management Tools;**3**;Jan 15, 2013;Build 42
;
EN ;-- entry point
N KMPDATE,KMPDFGBG,KMPDPTNP,KMPDSTAR,KMPDSTTL,KMPDSUB,KMPDTTL,POP,X,Y,ZTDESC,ZTRTN,ZTRSAVE,%ZIS
N KMPDLFG,KMPDLBG,KMPDDTSS
S KMPDTTL=" Average Coversheet Time-to-Load (TTL) Report "
D HDR^KMPDUTL4(KMPDTTL)
W !
W !?7,"This report displays the daily average time-to-load value for"
W !?7,"the coversheet at this site. Average time-to-load values are"
W !?7,"given for either daily prime time or non-prime time periods."
W !?7,"Foreground, background and combined values are reported."
W !
;
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,7,.KMPDATE)
Q:$G(KMPDATE(0))=""
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^KMPDTP1"
.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)
F KMPDSUB="ORWCV","ORWCV-FT" D DATA(.KMPDATE,KMPDPTNP,KMPDSUB)
D PRINT,EXIT
K ^TMP($J)
Q
;
DATA(KMPDATE,KMPDPTNP,KMPDSUB) ;-- compile data
Q:'$D(KMPDATE)
Q:'$G(KMPDPTNP)
N DATA,DATE,DOT,END,IEN,PTNP,QUEUED
S PTNP=(+KMPDPTNP)
S DOT=1,QUEUED=$D(ZTQUEUED)
S DATE=$P(KMPDATE(0),U)-.1,END=$P(KMPDATE(0),U,2)
Q:'DATE!('END)!('PTNP)
F S DATE=$O(^KMPD(8973.2,"ASSDTPT",KMPDSUB,DATE)) Q:'DATE!(DATE>END) D
.S IEN=0,^TMP($J,KMPDSUB,DATE)=""
.F S IEN=$O(^KMPD(8973.2,"ASSDTPT",KMPDSUB,DATE,PTNP,IEN)) Q:'IEN D
..Q:'$D(^KMPD(8973.2,IEN,0)) S DATA=^(0) Q:DATA=""
..I 'QUEUED S DOT=DOT+1 W:'(DOT#1000) "."
..; if delta
..I $P(DATA,U,4)'="" D
...; minimum delta
...I $P(^TMP($J,KMPDSUB,DATE),U,2)=""!($P(DATA,U,4)<$P(^TMP($J,KMPDSUB,DATE),U,2)) D
....S $P(^TMP($J,KMPDSUB,DATE),U,2)=$P(DATA,U,4)
...; maximum delta
...I $P(DATA,U,4)>$P(^TMP($J,KMPDSUB,DATE),U,3) S $P(^TMP($J,KMPDSUB,DATE),U,3)=$P(DATA,U,4)
...; total delta
...S $P(^TMP($J,KMPDSUB,DATE),U,4)=$P(^TMP($J,KMPDSUB,DATE),U,4)+$P(DATA,U,4)
...; count
...S $P(^TMP($J,KMPDSUB,DATE),U,5)=$P(^TMP($J,KMPDSUB,DATE),U,5)+1
..; if no delta
..E S $P(^TMP($J,KMPDSUB,DATE),U,6)=$P(^TMP($J,KMPDSUB,DATE),U,6)+1
..;
.; back to DATE level
.; average
.S:$P(^TMP($J,KMPDSUB,DATE),U,5) $P(^TMP($J,KMPDSUB,DATE),U)=$P(^TMP($J,KMPDSUB,DATE),U,4)/$P(^TMP($J,KMPDSUB,DATE),U,5)
;
;
Q
;
PRINT ;-- print data
U IO
S KMPDFGBG=0
I $D(^TMP($J,"ORWCV")) S KMPDFGBG=1
I $D(^TMP($J,"ORWCV-FT")) S KMPDFGBG=KMPDFGBG+2
I KMPDFGBG=1 D PRINTONE("ORWCV","Background")
I KMPDFGBG=2 D PRINTONE("ORWCV-FT","Foreground")
I KMPDFGBG=3 D PRNTBOTH
Q
;
PRINTONE(KMPDSUB,KMPDSTTL) ;
D HDR(KMPDSTTL)
Q:'$D(^TMP($J,KMPDSUB))
N DATE,TOTAL S (DATE,TOTAL)=""
S (DATE,TOTAL,KMPDSTAR)=""
F S DATE=$O(^TMP($J,KMPDSUB,DATE)) Q:'DATE S DATA=^TMP($J,KMPDSUB,DATE) D
.W !,$$FMTE^XLFDT(DATE,2)
.W ?12,$J($FN($P(DATA,U),",",0),10)
.W ?26,$J($FN($P(DATA,U,2),",",0),10)
.W ?40,$J($FN($P(DATA,U,3),",",0),10)
.W ?54,$J($FN($P(DATA,U,5),",",0),10)
.I $P(DATA,U,5)["*" W "*" S KMPDSTAR=1
.; total incompletes
.S TOTAL=TOTAL+$P(DATA,U,6)
;
W !!?12,"Incomplete: ",$J($FN(TOTAL,",",0),$L(TOTAL)+2)
; legend
W !!?2,"CV = Coversheet" I KMPDSTAR=1 W ?35,"* = BG/FG Load Counts not equal."
W !?2,"TTL = Time-to-Load" I KMPDSTAR=1 W ?35,"Listing FOREGROUND Load Count"
; pause if output to terminal
D CONTINUE^KMPDUTL4("Press RETURN to continue",4)
Q
;
PRNTBOTH ;
; AVG ^ MIN ^ MAX ^ TOTAL DELTA ^ COUNT
N DATE,TOTDATA,BGDATA,FGDATA,BGMIN,BGMAX,FGMIN,FGMAX,BGTOT,FGTOT
S DATE=""
F S DATE=$O(^TMP($J,"ORWCV-FT",DATE)) Q:'DATE D
.S TOTDATA=""
.S FGDATA=$G(^TMP($J,"ORWCV-FT",DATE))
.S BGDATA=$G(^TMP($J,"ORWCV",DATE))
.S $P(TOTDATA,U,1)=$P(BGDATA,U)+$P(FGDATA,U)
.S BGMIN=$P(BGDATA,U,2),FGMIN=$P(FGDATA,U,2)
.S $P(TOTDATA,U,2)=$S(FGMIN<BGMIN:FGMIN,1:BGMIN)
.S BGMAX=$P(BGDATA,U,3),FGMAX=$P(FGDATA,U,3)
.S $P(TOTDATA,U,3)=$S(BGMAX>FGMAX:BGMAX,1:FGMAX)
.S $P(TOTDATA,U,4)=$P(BGDATA,U,4)+$P(FGDATA,U,4)
.S BGTOT=$P(BGDATA,U,5),FGTOT=$P(FGDATA,U,5)
.S $P(TOTDATA,U,5)=$S(FGTOT=BGTOT:FGTOT,1:FGTOT_"*")
.S $P(TOTDATA,U,6)=$P(BGDATA,U,6)+$P(FGDATA,U,6)
.S ^TMP($J,"ORWCV-BOTH",DATE)=TOTDATA
D PRINTONE("ORWCV","BACKGROUND")
D PRINTONE("ORWCV-FT","FOREGROUND")
D PRINTONE("ORWCV-BOTH","Combined FOREGROUND and BACKGROUND")
;
HDR(KMPDSTTL) ;-- print header
W @IOF
N HDR,I
D HDR1(.HDR,KMPDSTTL)
F I=0:0 S I=$O(HDR(I)) Q:'I W !,HDR(I)
Q
;
HDR1(KMPDHDR,KMPDSTTL) ;- set up header array
K KMPDHDR
N X
S X=$G(KMPDTTL)
S KMPDHDR(1)=$J(" ",(80-$L(X)\2))_X
S X=$P($G(KMPDPTNP),U,2)_" - "_KMPDSTTL
S KMPDHDR(2)=$J(" ",(80-$L(X)\2))_X
S X=$G(KMPDATE(0)),X=$P(X,U,3)_" - "_$P(X,U,4)
S KMPDHDR(3)=$J(" ",(80-$L(X)\2))_X
S KMPDHDR(3)=KMPDHDR(3)_$J(" ",61-$L(KMPDHDR(3)))_"Printed: "_$$FMTE^XLFDT(DT,2)
S KMPDHDR(4)=""
S KMPDHDR(6)=$J("",12)_"|---------------Seconds---------------|"
S KMPDHDR(7)="Date"_$J(" ",8)_"Average TTL"_$J(" ",3)_"Minimum TTL"_$J(" ",3)_"Maximum TTL"_$J(" ",3)_"# of CV Loads"
S KMPDHDR(8)=$$REPEAT^XLFSTR("-",80)
;
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[HKMPDTP1 5995 printed Dec 13, 2024@01:40:45 Page 2
KMPDTP1 ;OAK/RAK/JML - CP Timing Time to Load Summary ;9/1/2015
+1 ;;3.0;Capacity Management Tools;**3**;Jan 15, 2013;Build 42
+2 ;
EN ;-- entry point
+1 NEW KMPDATE,KMPDFGBG,KMPDPTNP,KMPDSTAR,KMPDSTTL,KMPDSUB,KMPDTTL,POP,X,Y,ZTDESC,ZTRTN,ZTRSAVE,%ZIS
+2 NEW KMPDLFG,KMPDLBG,KMPDDTSS
+3 SET KMPDTTL=" Average Coversheet Time-to-Load (TTL) Report "
+4 DO HDR^KMPDUTL4(KMPDTTL)
+5 WRITE !
+6 WRITE !?7,"This report displays the daily average time-to-load value for"
+7 WRITE !?7,"the coversheet at this site. Average time-to-load values are"
+8 WRITE !?7,"given for either daily prime time or non-prime time periods."
+9 WRITE !?7,"Foreground, background and combined values are reported."
+10 WRITE !
+11 ;
+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,7,.KMPDATE)
+20 if $GET(KMPDATE(0))=""
QUIT
+21 SET KMPDPTNP=$$PTNPSEL^KMPDUTL4
+22 if 'KMPDPTNP
QUIT
+23 ; select output device.
+24 SET %ZIS="Q"
SET %ZIS("A")="Device: "
SET %ZIS("B")="HOME"
+25 WRITE !
DO ^%ZIS
IF POP
WRITE !,"No action taken."
QUIT
+26 ; if queued.
+27 IF $DATA(IO("Q"))
KILL IO("Q")
Begin DoDot:1
+28 SET ZTDESC=KMPDTTL
+29 SET ZTRTN="EN1^KMPDTP1"
+30 SET ZTSAVE("KMPDATE(")=""
SET ZTSAVE("KMPDPTNP")=""
SET ZTSAVE("KMPDTTL")=""
+31 DO ^%ZTLOAD
if $GET(ZTSK)
WRITE !,"Task #",ZTSK
+32 DO EXIT
End DoDot:1
QUIT
+33 ;
+34 ; if output to terminal display message.
+35 if $EXTRACT(IOST,1,2)="C-"
WRITE !,"Compiling timing stats..."
+36 DO EN1
+37 ;
+38 QUIT
+39 ;
EN1 ;-- entry point from taskman
+1 if '$DATA(KMPDATE)
QUIT
+2 if '$GET(KMPDPTNP)
QUIT
+3 KILL ^TMP($JOB)
+4 FOR KMPDSUB="ORWCV","ORWCV-FT"
DO DATA(.KMPDATE,KMPDPTNP,KMPDSUB)
+5 DO PRINT
DO EXIT
+6 KILL ^TMP($JOB)
+7 QUIT
+8 ;
DATA(KMPDATE,KMPDPTNP,KMPDSUB) ;-- compile data
+1 if '$DATA(KMPDATE)
QUIT
+2 if '$GET(KMPDPTNP)
QUIT
+3 NEW DATA,DATE,DOT,END,IEN,PTNP,QUEUED
+4 SET PTNP=(+KMPDPTNP)
+5 SET DOT=1
SET QUEUED=$DATA(ZTQUEUED)
+6 SET DATE=$PIECE(KMPDATE(0),U)-.1
SET END=$PIECE(KMPDATE(0),U,2)
+7 if 'DATE!('END)!('PTNP)
QUIT
+8 FOR
SET DATE=$ORDER(^KMPD(8973.2,"ASSDTPT",KMPDSUB,DATE))
if 'DATE!(DATE>END)
QUIT
Begin DoDot:1
+9 SET IEN=0
SET ^TMP($JOB,KMPDSUB,DATE)=""
+10 FOR
SET IEN=$ORDER(^KMPD(8973.2,"ASSDTPT",KMPDSUB,DATE,PTNP,IEN))
if 'IEN
QUIT
Begin DoDot:2
+11 if '$DATA(^KMPD(8973.2,IEN,0))
QUIT
SET DATA=^(0)
if DATA=""
QUIT
+12 IF 'QUEUED
SET DOT=DOT+1
if '(DOT#1000)
WRITE "."
+13 ; if delta
+14 IF $PIECE(DATA,U,4)'=""
Begin DoDot:3
+15 ; minimum delta
+16 IF $PIECE(^TMP($JOB,KMPDSUB,DATE),U,2)=""!($PIECE(DATA,U,4)<$PIECE(^TMP($JOB,KMPDSUB,DATE),U,2))
Begin DoDot:4
+17 SET $PIECE(^TMP($JOB,KMPDSUB,DATE),U,2)=$PIECE(DATA,U,4)
End DoDot:4
+18 ; maximum delta
+19 IF $PIECE(DATA,U,4)>$PIECE(^TMP($JOB,KMPDSUB,DATE),U,3)
SET $PIECE(^TMP($JOB,KMPDSUB,DATE),U,3)=$PIECE(DATA,U,4)
+20 ; total delta
+21 SET $PIECE(^TMP($JOB,KMPDSUB,DATE),U,4)=$PIECE(^TMP($JOB,KMPDSUB,DATE),U,4)+$PIECE(DATA,U,4)
+22 ; count
+23 SET $PIECE(^TMP($JOB,KMPDSUB,DATE),U,5)=$PIECE(^TMP($JOB,KMPDSUB,DATE),U,5)+1
End DoDot:3
+24 ; if no delta
+25 IF '$TEST
SET $PIECE(^TMP($JOB,KMPDSUB,DATE),U,6)=$PIECE(^TMP($JOB,KMPDSUB,DATE),U,6)+1
+26 ;
End DoDot:2
+27 ; back to DATE level
+28 ; average
+29 if $PIECE(^TMP($JOB,KMPDSUB,DATE),U,5)
SET $PIECE(^TMP($JOB,KMPDSUB,DATE),U)=$PIECE(^TMP($JOB,KMPDSUB,DATE),U,4)/$PIECE(^TMP($JOB,KMPDSUB,DATE),U,5)
End DoDot:1
+30 ;
+31 ;
+32 QUIT
+33 ;
PRINT ;-- print data
+1 USE IO
+2 SET KMPDFGBG=0
+3 IF $DATA(^TMP($JOB,"ORWCV"))
SET KMPDFGBG=1
+4 IF $DATA(^TMP($JOB,"ORWCV-FT"))
SET KMPDFGBG=KMPDFGBG+2
+5 IF KMPDFGBG=1
DO PRINTONE("ORWCV","Background")
+6 IF KMPDFGBG=2
DO PRINTONE("ORWCV-FT","Foreground")
+7 IF KMPDFGBG=3
DO PRNTBOTH
+8 QUIT
+9 ;
PRINTONE(KMPDSUB,KMPDSTTL) ;
+1 DO HDR(KMPDSTTL)
+2 if '$DATA(^TMP($JOB,KMPDSUB))
QUIT
+3 NEW DATE,TOTAL
SET (DATE,TOTAL)=""
+4 SET (DATE,TOTAL,KMPDSTAR)=""
+5 FOR
SET DATE=$ORDER(^TMP($JOB,KMPDSUB,DATE))
if 'DATE
QUIT
SET DATA=^TMP($JOB,KMPDSUB,DATE)
Begin DoDot:1
+6 WRITE !,$$FMTE^XLFDT(DATE,2)
+7 WRITE ?12,$JUSTIFY($FNUMBER($PIECE(DATA,U),",",0),10)
+8 WRITE ?26,$JUSTIFY($FNUMBER($PIECE(DATA,U,2),",",0),10)
+9 WRITE ?40,$JUSTIFY($FNUMBER($PIECE(DATA,U,3),",",0),10)
+10 WRITE ?54,$JUSTIFY($FNUMBER($PIECE(DATA,U,5),",",0),10)
+11 IF $PIECE(DATA,U,5)["*"
WRITE "*"
SET KMPDSTAR=1
+12 ; total incompletes
+13 SET TOTAL=TOTAL+$PIECE(DATA,U,6)
End DoDot:1
+14 ;
+15 WRITE !!?12,"Incomplete: ",$JUSTIFY($FNUMBER(TOTAL,",",0),$LENGTH(TOTAL)+2)
+16 ; legend
+17 WRITE !!?2,"CV = Coversheet"
IF KMPDSTAR=1
WRITE ?35,"* = BG/FG Load Counts not equal."
+18 WRITE !?2,"TTL = Time-to-Load"
IF KMPDSTAR=1
WRITE ?35,"Listing FOREGROUND Load Count"
+19 ; pause if output to terminal
+20 DO CONTINUE^KMPDUTL4("Press RETURN to continue",4)
+21 QUIT
+22 ;
PRNTBOTH ;
+1 ; AVG ^ MIN ^ MAX ^ TOTAL DELTA ^ COUNT
+2 NEW DATE,TOTDATA,BGDATA,FGDATA,BGMIN,BGMAX,FGMIN,FGMAX,BGTOT,FGTOT
+3 SET DATE=""
+4 FOR
SET DATE=$ORDER(^TMP($JOB,"ORWCV-FT",DATE))
if 'DATE
QUIT
Begin DoDot:1
+5 SET TOTDATA=""
+6 SET FGDATA=$GET(^TMP($JOB,"ORWCV-FT",DATE))
+7 SET BGDATA=$GET(^TMP($JOB,"ORWCV",DATE))
+8 SET $PIECE(TOTDATA,U,1)=$PIECE(BGDATA,U)+$PIECE(FGDATA,U)
+9 SET BGMIN=$PIECE(BGDATA,U,2)
SET FGMIN=$PIECE(FGDATA,U,2)
+10 SET $PIECE(TOTDATA,U,2)=$SELECT(FGMIN<BGMIN:FGMIN,1:BGMIN)
+11 SET BGMAX=$PIECE(BGDATA,U,3)
SET FGMAX=$PIECE(FGDATA,U,3)
+12 SET $PIECE(TOTDATA,U,3)=$SELECT(BGMAX>FGMAX:BGMAX,1:FGMAX)
+13 SET $PIECE(TOTDATA,U,4)=$PIECE(BGDATA,U,4)+$PIECE(FGDATA,U,4)
+14 SET BGTOT=$PIECE(BGDATA,U,5)
SET FGTOT=$PIECE(FGDATA,U,5)
+15 SET $PIECE(TOTDATA,U,5)=$SELECT(FGTOT=BGTOT:FGTOT,1:FGTOT_"*")
+16 SET $PIECE(TOTDATA,U,6)=$PIECE(BGDATA,U,6)+$PIECE(FGDATA,U,6)
+17 SET ^TMP($JOB,"ORWCV-BOTH",DATE)=TOTDATA
End DoDot:1
+18 DO PRINTONE("ORWCV","BACKGROUND")
+19 DO PRINTONE("ORWCV-FT","FOREGROUND")
+20 DO PRINTONE("ORWCV-BOTH","Combined FOREGROUND and BACKGROUND")
+21 ;
HDR(KMPDSTTL) ;-- print header
+1 WRITE @IOF
+2 NEW HDR,I
+3 DO HDR1(.HDR,KMPDSTTL)
+4 FOR I=0:0
SET I=$ORDER(HDR(I))
if 'I
QUIT
WRITE !,HDR(I)
+5 QUIT
+6 ;
HDR1(KMPDHDR,KMPDSTTL) ;- set up header array
+1 KILL KMPDHDR
+2 NEW X
+3 SET X=$GET(KMPDTTL)
+4 SET KMPDHDR(1)=$JUSTIFY(" ",(80-$LENGTH(X)\2))_X
+5 SET X=$PIECE($GET(KMPDPTNP),U,2)_" - "_KMPDSTTL
+6 SET KMPDHDR(2)=$JUSTIFY(" ",(80-$LENGTH(X)\2))_X
+7 SET X=$GET(KMPDATE(0))
SET X=$PIECE(X,U,3)_" - "_$PIECE(X,U,4)
+8 SET KMPDHDR(3)=$JUSTIFY(" ",(80-$LENGTH(X)\2))_X
+9 SET KMPDHDR(3)=KMPDHDR(3)_$JUSTIFY(" ",61-$LENGTH(KMPDHDR(3)))_"Printed: "_$$FMTE^XLFDT(DT,2)
+10 SET KMPDHDR(4)=""
+11 SET KMPDHDR(6)=$JUSTIFY("",12)_"|---------------Seconds---------------|"
+12 SET KMPDHDR(7)="Date"_$JUSTIFY(" ",8)_"Average TTL"_$JUSTIFY(" ",3)_"Minimum TTL"_$JUSTIFY(" ",3)_"Maximum TTL"_$JUSTIFY(" ",3)_"# of CV Loads"
+13 SET KMPDHDR(8)=$$REPEAT^XLFSTR("-",80)
+14 ;
+15 QUIT
+16 ;
EXIT ;-- cleanup on exit
+1 if $DATA(ZTQUEUED)
SET ZTREQ="@"
+2 DO ^%ZISC
+3 KILL KMPDATE,KMPDPTNP,KMPDTTL
+4 QUIT