PXRMCVTM ;SLC/AGP - CPRS Coversheet timer test. ;10/14/2020
;;2.0;CLINICAL REMINDERS;**45,42**;Feb 04, 2005;Build 245
;
;===============
EN ;Prompt for patient and reminder by name input component.
N BOP,CLOCKE,CLOCKS,CNT,CPUTMAX,DFN,DIC,DIROUT,DIRUT,DTOUT,DUOUT
N IDX,IENMAXC,IENMAXW,LOC,MSEC,NL,OUTPUT
N REMIEN,REMS,TOTTM,USER,WCDIFF,WCMAX,X,Y
S DIC=2,DIC("A")="Select Patient: "
S DIC(0)="AEQMZ"
GPAT D ^DIC
I $D(DIROUT)!$D(DIRUT) Q
I $D(DTOUT)!$D(DUOUT) Q
S DFN=+$P(Y,U)
I DFN=-1 G GPAT
;
GUSER ;
K Y
S DIC=200,DIC("A")="Select User: "
S DIC(0)="AEQMZ"
D ^DIC
I $D(DIROUT)!$D(DIRUT) Q
I $D(DTOUT)!$D(DUOUT) Q
S USER=+$P(Y,U)
I USER=-1 G GUSER
;
GLOC ;
K Y
S DIC=44,DIC("A")="Select Location: "
S DIC(0)="AEQMZ"
D ^DIC
I $D(DIROUT)!$D(DIRUT) Q
I $D(DTOUT)!$D(DUOUT) Q
S LOC=+$P(Y,U)
I LOC=-1 G GLOC
;
GCVL ;
S NL=1,OUTPUT(NL)="Patient: "_$P(^DPT(DFN,0),U,1)
S NL=NL+1,OUTPUT(NL)="User: "_$P(^VA(200,USER,0),U,1)
S NL=NL+1,OUTPUT(NL)="Location: "_$P(^SC(LOC,0),U,1)
S NL=NL+1,OUTPUT(NL)=""
S CLOCKS=$H
D REMLIST^PXRMCVRL(.REMS,USER,LOC)
S IDX=+$O(REMS(""))
I IDX=0 D G REPORT
. S NL=NL+1,OUTPUT(NL)="There are no cover sheet reminders defined for this user and location."
S CLOCKE=$H
S NL=NL+1,OUTPUT(NL)="Total time to build reminder list: "_$$HDIFF^XLFDT(CLOCKE,CLOCKS,2)_" seconds"
S (IENMAXC,IENMAXW)=$P(REMS(IDX),U,2)
S (CNT,CPUTMAX,TOTTM,WCMAX)=0,IDX=""
S CLOCKS=$H
S CNT=0,IDX=""
F S IDX=$O(REMS(IDX)) Q:IDX="" D
.S REMIEN=$P(REMS(IDX),U,2)
.D DOREM(DFN,REMIEN,0,DT,.NL,.OUTPUT,.MSEC,.WCDIFF)
.I MSEC>CPUTMAX S CPUTMAX=MSEC,IENMAXC=REMIEN
.S TOTTM=TOTTM+MSEC
.I WCDIFF>WCMAX S WCMAX=WCDIFF,IENMAXW=REMIEN
.S CNT=CNT+1
S CLOCKE=$H
S NL=NL+1,OUTPUT(NL)=""
S NL=NL+1,OUTPUT(NL)="Total number of reminders evaluated: "_CNT
S NL=NL+1,OUTPUT(NL)=""
S NL=NL+1,OUTPUT(NL)="Elapsed wall clock time: "_$$HDIFF^XLFDT(CLOCKE,CLOCKS,2)_" seconds"
S NL=NL+1,OUTPUT(NL)="Total CPU cover sheet evaluation time: "_TOTTM_" milliseconds"
S NL=NL+1,OUTPUT(NL)=""
S NL=NL+1,OUTPUT(NL)="Longest CPU evaluation time"
S NL=NL+1,OUTPUT(NL)="Reminder: "_$P(^PXD(811.9,IENMAXC,0),U)_" (IEN="_IENMAXC_")"
S NL=NL+1,OUTPUT(NL)="Reminder CPU evaluation time: "_CPUTMAX_" milliseconds"
S NL=NL+1,OUTPUT(NL)=""
S NL=NL+1,OUTPUT(NL)="Longest wall clock evaluation time"
S NL=NL+1,OUTPUT(NL)="Reminder: "_$P(^PXD(811.9,IENMAXW,0),U)_" (IEN="_IENMAXW_")"
S NL=NL+1,OUTPUT(NL)="Reminder wall clock evaluation time: "_WCMAX_" seconds"
S NL=NL+1,OUTPUT(NL)=""
REPORT ; Display the report.
S BOP=$$BORP^PXRMUTIL("B")
I BOP="B" D
. S X="IORESET"
. D ENDR^%ZISS
. D BROWSE^DDBR("OUTPUT","NR","CPRS Cover Sheet Timing Test")
. W IORESET
. D KILL^%ZISS
I BOP="P" D GPRINT^PXRMUTIL("OUTPUT")
Q
;
DOREM(DFN,PXRMITEM,PXRHM,DATE,NL,OUTPUT,MSEC,WCDIFF) ;Do the reminder
;Reference to XLFSHAN ICR #6157
N DEFARR,END,ETIME,FIEVAL,START,WEND,WSTART
;This is a debugging run so set PXRMDEBG.
S START=$$CPUTIME^XLFSHAN
S WSTART=$H
D DEF^PXRMLDR(PXRMITEM,.DEFARR)
I +$G(DATE)=0 D EVAL^PXRM(DFN,.DEFARR,PXRHM,1,.FIEVAL)
I +$G(DATE)>0 D EVAL^PXRM(DFN,.DEFARR,PXRHM,1,.FIEVAL,DATE)
S END=$$CPUTIME^XLFSHAN
S WEND=$H
;
S WCDIFF=$$HDIFF^XLFDT(WEND,WSTART,2)
S ETIME=$$ETIMEMS^XLFSHAN(START,END)
S MSEC=+ETIME
S NL=NL+1,OUTPUT(NL)=""
S NL=NL+1,OUTPUT(NL)="Reminder: "_$P(^PXD(811.9,PXRMITEM,0),U)_" (IEN="_PXRMITEM_")"
S NL=NL+1,OUTPUT(NL)="Reminder CPU evaluation time: "_ETIME
S NL=NL+1,OUTPUT(NL)="Reminder wall clock evaluation time: "_WCDIFF_" seconds"
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXRMCVTM 3618 printed Dec 13, 2024@01:43:26 Page 2
PXRMCVTM ;SLC/AGP - CPRS Coversheet timer test. ;10/14/2020
+1 ;;2.0;CLINICAL REMINDERS;**45,42**;Feb 04, 2005;Build 245
+2 ;
+3 ;===============
EN ;Prompt for patient and reminder by name input component.
+1 NEW BOP,CLOCKE,CLOCKS,CNT,CPUTMAX,DFN,DIC,DIROUT,DIRUT,DTOUT,DUOUT
+2 NEW IDX,IENMAXC,IENMAXW,LOC,MSEC,NL,OUTPUT
+3 NEW REMIEN,REMS,TOTTM,USER,WCDIFF,WCMAX,X,Y
+4 SET DIC=2
SET DIC("A")="Select Patient: "
+5 SET DIC(0)="AEQMZ"
GPAT DO ^DIC
+1 IF $DATA(DIROUT)!$DATA(DIRUT)
QUIT
+2 IF $DATA(DTOUT)!$DATA(DUOUT)
QUIT
+3 SET DFN=+$PIECE(Y,U)
+4 IF DFN=-1
GOTO GPAT
+5 ;
GUSER ;
+1 KILL Y
+2 SET DIC=200
SET DIC("A")="Select User: "
+3 SET DIC(0)="AEQMZ"
+4 DO ^DIC
+5 IF $DATA(DIROUT)!$DATA(DIRUT)
QUIT
+6 IF $DATA(DTOUT)!$DATA(DUOUT)
QUIT
+7 SET USER=+$PIECE(Y,U)
+8 IF USER=-1
GOTO GUSER
+9 ;
GLOC ;
+1 KILL Y
+2 SET DIC=44
SET DIC("A")="Select Location: "
+3 SET DIC(0)="AEQMZ"
+4 DO ^DIC
+5 IF $DATA(DIROUT)!$DATA(DIRUT)
QUIT
+6 IF $DATA(DTOUT)!$DATA(DUOUT)
QUIT
+7 SET LOC=+$PIECE(Y,U)
+8 IF LOC=-1
GOTO GLOC
+9 ;
GCVL ;
+1 SET NL=1
SET OUTPUT(NL)="Patient: "_$PIECE(^DPT(DFN,0),U,1)
+2 SET NL=NL+1
SET OUTPUT(NL)="User: "_$PIECE(^VA(200,USER,0),U,1)
+3 SET NL=NL+1
SET OUTPUT(NL)="Location: "_$PIECE(^SC(LOC,0),U,1)
+4 SET NL=NL+1
SET OUTPUT(NL)=""
+5 SET CLOCKS=$HOROLOG
+6 DO REMLIST^PXRMCVRL(.REMS,USER,LOC)
+7 SET IDX=+$ORDER(REMS(""))
+8 IF IDX=0
Begin DoDot:1
+9 SET NL=NL+1
SET OUTPUT(NL)="There are no cover sheet reminders defined for this user and location."
End DoDot:1
GOTO REPORT
+10 SET CLOCKE=$HOROLOG
+11 SET NL=NL+1
SET OUTPUT(NL)="Total time to build reminder list: "_$$HDIFF^XLFDT(CLOCKE,CLOCKS,2)_" seconds"
+12 SET (IENMAXC,IENMAXW)=$PIECE(REMS(IDX),U,2)
+13 SET (CNT,CPUTMAX,TOTTM,WCMAX)=0
SET IDX=""
+14 SET CLOCKS=$HOROLOG
+15 SET CNT=0
SET IDX=""
+16 FOR
SET IDX=$ORDER(REMS(IDX))
if IDX=""
QUIT
Begin DoDot:1
+17 SET REMIEN=$PIECE(REMS(IDX),U,2)
+18 DO DOREM(DFN,REMIEN,0,DT,.NL,.OUTPUT,.MSEC,.WCDIFF)
+19 IF MSEC>CPUTMAX
SET CPUTMAX=MSEC
SET IENMAXC=REMIEN
+20 SET TOTTM=TOTTM+MSEC
+21 IF WCDIFF>WCMAX
SET WCMAX=WCDIFF
SET IENMAXW=REMIEN
+22 SET CNT=CNT+1
End DoDot:1
+23 SET CLOCKE=$HOROLOG
+24 SET NL=NL+1
SET OUTPUT(NL)=""
+25 SET NL=NL+1
SET OUTPUT(NL)="Total number of reminders evaluated: "_CNT
+26 SET NL=NL+1
SET OUTPUT(NL)=""
+27 SET NL=NL+1
SET OUTPUT(NL)="Elapsed wall clock time: "_$$HDIFF^XLFDT(CLOCKE,CLOCKS,2)_" seconds"
+28 SET NL=NL+1
SET OUTPUT(NL)="Total CPU cover sheet evaluation time: "_TOTTM_" milliseconds"
+29 SET NL=NL+1
SET OUTPUT(NL)=""
+30 SET NL=NL+1
SET OUTPUT(NL)="Longest CPU evaluation time"
+31 SET NL=NL+1
SET OUTPUT(NL)="Reminder: "_$PIECE(^PXD(811.9,IENMAXC,0),U)_" (IEN="_IENMAXC_")"
+32 SET NL=NL+1
SET OUTPUT(NL)="Reminder CPU evaluation time: "_CPUTMAX_" milliseconds"
+33 SET NL=NL+1
SET OUTPUT(NL)=""
+34 SET NL=NL+1
SET OUTPUT(NL)="Longest wall clock evaluation time"
+35 SET NL=NL+1
SET OUTPUT(NL)="Reminder: "_$PIECE(^PXD(811.9,IENMAXW,0),U)_" (IEN="_IENMAXW_")"
+36 SET NL=NL+1
SET OUTPUT(NL)="Reminder wall clock evaluation time: "_WCMAX_" seconds"
+37 SET NL=NL+1
SET OUTPUT(NL)=""
REPORT ; Display the report.
+1 SET BOP=$$BORP^PXRMUTIL("B")
+2 IF BOP="B"
Begin DoDot:1
+3 SET X="IORESET"
+4 DO ENDR^%ZISS
+5 DO BROWSE^DDBR("OUTPUT","NR","CPRS Cover Sheet Timing Test")
+6 WRITE IORESET
+7 DO KILL^%ZISS
End DoDot:1
+8 IF BOP="P"
DO GPRINT^PXRMUTIL("OUTPUT")
+9 QUIT
+10 ;
DOREM(DFN,PXRMITEM,PXRHM,DATE,NL,OUTPUT,MSEC,WCDIFF) ;Do the reminder
+1 ;Reference to XLFSHAN ICR #6157
+2 NEW DEFARR,END,ETIME,FIEVAL,START,WEND,WSTART
+3 ;This is a debugging run so set PXRMDEBG.
+4 SET START=$$CPUTIME^XLFSHAN
+5 SET WSTART=$HOROLOG
+6 DO DEF^PXRMLDR(PXRMITEM,.DEFARR)
+7 IF +$GET(DATE)=0
DO EVAL^PXRM(DFN,.DEFARR,PXRHM,1,.FIEVAL)
+8 IF +$GET(DATE)>0
DO EVAL^PXRM(DFN,.DEFARR,PXRHM,1,.FIEVAL,DATE)
+9 SET END=$$CPUTIME^XLFSHAN
+10 SET WEND=$HOROLOG
+11 ;
+12 SET WCDIFF=$$HDIFF^XLFDT(WEND,WSTART,2)
+13 SET ETIME=$$ETIMEMS^XLFSHAN(START,END)
+14 SET MSEC=+ETIME
+15 SET NL=NL+1
SET OUTPUT(NL)=""
+16 SET NL=NL+1
SET OUTPUT(NL)="Reminder: "_$PIECE(^PXD(811.9,PXRMITEM,0),U)_" (IEN="_PXRMITEM_")"
+17 SET NL=NL+1
SET OUTPUT(NL)="Reminder CPU evaluation time: "_ETIME
+18 SET NL=NL+1
SET OUTPUT(NL)="Reminder wall clock evaluation time: "_WCDIFF_" seconds"
+19 QUIT
+20 ;