KMPDU7 ;OAK/RAK - CM Tools Routine Utilities ;7/22/04 09:06
;;3.0;KMPD;;Jan 22, 2009;Build 42
;
;
SBLIST(KMPDY,KMPDLIST,KMPDSS,KMPDGBL) ;-- rpc search by list
;-------------------------------------------------------------------
; KMPDY()... return array (see LISTSEL^KMPDTU10 for details)
; KMPDLIST.. search by list
; 2 - client name
; 3 - ip address
; KMPDSS.... free text - timing monitor subscript
; KMPDGBL... global name to store results
;-------------------------------------------------------------------
;
K KMPDY
S KMPDLIST=+$G(KMPDLIST),KMPDSS=$G(KMPDSS)
I (KMPDLIST<2)!(KMPDLIST>3) S KMPDY(0)="[Search By entry is invalid]" Q
I KMPDSS="" S KMPDY(0)="[Subscript is null]" Q
;
N I
;
K ^TMP("KMPDTU10-LIST",$J)
D:KMPDLIST=2 LISTSELR^KMPDTU10
D:KMPDLIST=3 LISTSELH^KMPDTU10
I '$O(^TMP("KMPDTU10-LIST",$J,0)) S KMPDY(0)="<No Data to Report>" Q
;
F I=0:0 S I=$O(^TMP("KMPDTU10-LIST",$J,I)) Q:'I D
.S @KMPDGBL@(I)=$G(^TMP("KMPDTU10-LIST",$J,I,0))
;
S KMPDY=$NA(@KMPDGBL)
;
Q
;
TMGDATES(KMPDY,KMPDSS) ;-- rpc timing date ranges
;-------------------------------------------------------------------
; KMPDY()... return value
; KMPDY(0)=FMStartDate^FMEndDate^ExtStartDate^ExtEndDate
; KMPDY(1)=FMDate^ExtDate
; KMPDY(2)=FMDate^ExtDate
; KMPDY(...)=...
; KMPDSS.... timing subscript
;-------------------------------------------------------------------
;
K KMPDY
;
I $G(KMPDSS)="" S KMPDY(0)="[Timing Subscript is not defined]" Q
;
N DATE,I,LN,SESSION
;
S DATE=$$DATERNG1^KMPDTU10(KMPDSS,.SESSION)
I 'DATE S KMPDY(0)="<There are no Timing Monitor Dates available>" Q
S $P(KMPDY(0),U)=$P(DATE,U)
S $P(KMPDY(0),U,2)=$$FMTE^XLFDT($P(DATE,U))
S $P(KMPDY(0),U,3)=$P(DATE,U,2)
S $P(KMPDY(0),U,4)=$$FMTE^XLFDT($P(DATE,U,2))
S (I,LN)=0
F S I=$O(SESSION(I)) Q:'I D
.S LN=LN+1
.S KMPDY(LN)=I_"^"_$$FMTE^XLFDT(I)
;
;
Q
;
TMGMON(KMPDY,KMPDSTM) ;-- timing monitor data
;-------------------------------------------------------------------
; remote procedure: KMPD TMG MON DATA
;
; KMPDY()... return value:
; KMPDY(0)= ^piece 1: Last Updated
; piece 2: Running Time
; piece 3: Update Minutes
; piece 4: alert seconds
; piece 5: start time
; KMPDY(...) Hour^AverageDeltaSeconds^AverageCount
;
; KMPDSTM... monitor start time in internal fileman format. if not
; defined this will be set as NOW.
;-------------------------------------------------------------------
;
K KMPDY
;
S:'$G(KMPDSTM) KMPDSTM=$$NOW^XLFDT
;
N DATA,I,KMPUTIME,KMPUTMP,LN,NOW
;
D DATA^KMPDTM
I '$D(KMPUTMP) S KMPDY(0)="<No Timing Monitor Data to Report>" Q
;
S NOW=$$NOW^XLFDT
S DATA=$G(^KMPD(8973,1,19))
; zero node: LastUpdated^RunningTime^UpdateMinutes^AlertSeconds
S $P(KMPDY(0),U)=$P($$FMTE^XLFDT(NOW),"@",2)
S $P(KMPDY(0),U,2)=$$FMDIFF^XLFDT(NOW,KMPDSTM,3)
S $P(KMPDY(0),U,3)=$S($P(DATA,U):$P(DATA,U),1:10)
S $P(KMPDY(0),U,4)=$S($P(DATA,U,2):$P(DATA,U,2),1:30)
S $P(KMPDY(0),U,5)=KMPDSTM
;
S LN=0
F I=0:0 S I=$O(KMPUTMP(I)) Q:'I D
.S LN=LN+1,KMPDY(LN)=$G(KMPUTMP(I,0))
;
Q
;
TMGRPT(KMPDY,KMPDRPT,KMPDTM,KMPDATE,KMPDSRCH,KMPDTSEC,KMPDHOUR) ;-- rpc - timing reports
;-------------------------------------------------------------------
; KMPDY()... array containing report
; KMPDRPT... report name (free text)
; KMPDTM.... time frame - prime time or non-prime time
; KMPDATE... date (fileman format)
; KMPDSRCH.. ttl search text
; 1: User Name
; 2: Client Name
; 3: IP Address
; 4: All Items
; KMPDTSEC.. seconds
; KMPDTHR... hour
;-------------------------------------------------------------------
;
K KMPDY
;
S KMPDRPT=$G(KMPDRPT)
I KMPDRPT="" S KMPDY(0)="[There is no Report Name]" Q
S KMPDTM=$G(KMPDTM)
I KMPDTM="" S KMPDY(0)="[There is no Time Frame]" Q
I '$D(KMPDATE) S KMPDY(0)="[There is no Ending Date]" Q
;
N DATA,DATE,HR,I,KMPDPTNP,LN
;
K ^TMP($J)
;
I KMPDRPT="TMG - Average Daily Coversheet Load" D ADCL^KMPDU7A
I KMPDRPT="TMG - Average Hourly Coversheet Load" D AHCR^KMPDU7A
I KMPDRPT="TMG - Coversheet TTL Alert Report" D CTTLAR^KMPDU7A
I KMPDRPT="TMG - Daily Coversheet TTL Detailed Report" D DCTTLDR^KMPDU7A
I KMPDRPT="TMG - Hourly Coversheet TTL Detailed Report" D HCTTLDR^KMPDU7A
I KMPDRPT="TMG - Real-Time Average Hourly Coversheet Load" D RTAHCL^KMPDU7A
I KMPDRPT="TMG - Real-Time Threshold Alert" D RTTA^KMPDU7A
;
S:'$D(KMPDY) KMPDY(0)="<No Data to Report>"
;
Q
;
TMGSST(KMPDY,KMPDSST) ;-- rpc - start/stop timing monitor
;-------------------------------------------------------------------
; KMPDY()... array containing timing monitor status
; 0 - timing monitor is off
; 1 - timing monitor is on
; KMPSST.... start/stop
; 0 - stop timing monitor
; 1 - start timing monitor
;-------------------------------------------------------------------
;
S KMPDSST=+$G(KMPDSST)
S:KMPDSST>1 KMPDSST=1
S ^KMPTMP("KMPD-CPRS")=KMPDSST
S KMPDY(0)=KMPDSST
Q
;
TMGSTAT(KMPDY) ;-- rpc - timing monitor status
;-------------------------------------------------------------------
; KMPDY()... array containing timing monitor status
; 0 - timing monitor is off
; 1 - timing monitor is on
;-------------------------------------------------------------------
;
S KMPDY(0)=$G(^KMPTMP("KMPD-CPRS"))
;
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HKMPDU7 5735 printed Dec 13, 2024@01:41:03 Page 2
KMPDU7 ;OAK/RAK - CM Tools Routine Utilities ;7/22/04 09:06
+1 ;;3.0;KMPD;;Jan 22, 2009;Build 42
+2 ;
+3 ;
SBLIST(KMPDY,KMPDLIST,KMPDSS,KMPDGBL) ;-- rpc search by list
+1 ;-------------------------------------------------------------------
+2 ; KMPDY()... return array (see LISTSEL^KMPDTU10 for details)
+3 ; KMPDLIST.. search by list
+4 ; 2 - client name
+5 ; 3 - ip address
+6 ; KMPDSS.... free text - timing monitor subscript
+7 ; KMPDGBL... global name to store results
+8 ;-------------------------------------------------------------------
+9 ;
+10 KILL KMPDY
+11 SET KMPDLIST=+$GET(KMPDLIST)
SET KMPDSS=$GET(KMPDSS)
+12 IF (KMPDLIST<2)!(KMPDLIST>3)
SET KMPDY(0)="[Search By entry is invalid]"
QUIT
+13 IF KMPDSS=""
SET KMPDY(0)="[Subscript is null]"
QUIT
+14 ;
+15 NEW I
+16 ;
+17 KILL ^TMP("KMPDTU10-LIST",$JOB)
+18 if KMPDLIST=2
DO LISTSELR^KMPDTU10
+19 if KMPDLIST=3
DO LISTSELH^KMPDTU10
+20 IF '$ORDER(^TMP("KMPDTU10-LIST",$JOB,0))
SET KMPDY(0)="<No Data to Report>"
QUIT
+21 ;
+22 FOR I=0:0
SET I=$ORDER(^TMP("KMPDTU10-LIST",$JOB,I))
if 'I
QUIT
Begin DoDot:1
+23 SET @KMPDGBL@(I)=$GET(^TMP("KMPDTU10-LIST",$JOB,I,0))
End DoDot:1
+24 ;
+25 SET KMPDY=$NAME(@KMPDGBL)
+26 ;
+27 QUIT
+28 ;
TMGDATES(KMPDY,KMPDSS) ;-- rpc timing date ranges
+1 ;-------------------------------------------------------------------
+2 ; KMPDY()... return value
+3 ; KMPDY(0)=FMStartDate^FMEndDate^ExtStartDate^ExtEndDate
+4 ; KMPDY(1)=FMDate^ExtDate
+5 ; KMPDY(2)=FMDate^ExtDate
+6 ; KMPDY(...)=...
+7 ; KMPDSS.... timing subscript
+8 ;-------------------------------------------------------------------
+9 ;
+10 KILL KMPDY
+11 ;
+12 IF $GET(KMPDSS)=""
SET KMPDY(0)="[Timing Subscript is not defined]"
QUIT
+13 ;
+14 NEW DATE,I,LN,SESSION
+15 ;
+16 SET DATE=$$DATERNG1^KMPDTU10(KMPDSS,.SESSION)
+17 IF 'DATE
SET KMPDY(0)="<There are no Timing Monitor Dates available>"
QUIT
+18 SET $PIECE(KMPDY(0),U)=$PIECE(DATE,U)
+19 SET $PIECE(KMPDY(0),U,2)=$$FMTE^XLFDT($PIECE(DATE,U))
+20 SET $PIECE(KMPDY(0),U,3)=$PIECE(DATE,U,2)
+21 SET $PIECE(KMPDY(0),U,4)=$$FMTE^XLFDT($PIECE(DATE,U,2))
+22 SET (I,LN)=0
+23 FOR
SET I=$ORDER(SESSION(I))
if 'I
QUIT
Begin DoDot:1
+24 SET LN=LN+1
+25 SET KMPDY(LN)=I_"^"_$$FMTE^XLFDT(I)
End DoDot:1
+26 ;
+27 ;
+28 QUIT
+29 ;
TMGMON(KMPDY,KMPDSTM) ;-- timing monitor data
+1 ;-------------------------------------------------------------------
+2 ; remote procedure: KMPD TMG MON DATA
+3 ;
+4 ; KMPDY()... return value:
+5 ; KMPDY(0)= ^piece 1: Last Updated
+6 ; piece 2: Running Time
+7 ; piece 3: Update Minutes
+8 ; piece 4: alert seconds
+9 ; piece 5: start time
+10 ; KMPDY(...) Hour^AverageDeltaSeconds^AverageCount
+11 ;
+12 ; KMPDSTM... monitor start time in internal fileman format. if not
+13 ; defined this will be set as NOW.
+14 ;-------------------------------------------------------------------
+15 ;
+16 KILL KMPDY
+17 ;
+18 if '$GET(KMPDSTM)
SET KMPDSTM=$$NOW^XLFDT
+19 ;
+20 NEW DATA,I,KMPUTIME,KMPUTMP,LN,NOW
+21 ;
+22 DO DATA^KMPDTM
+23 IF '$DATA(KMPUTMP)
SET KMPDY(0)="<No Timing Monitor Data to Report>"
QUIT
+24 ;
+25 SET NOW=$$NOW^XLFDT
+26 SET DATA=$GET(^KMPD(8973,1,19))
+27 ; zero node: LastUpdated^RunningTime^UpdateMinutes^AlertSeconds
+28 SET $PIECE(KMPDY(0),U)=$PIECE($$FMTE^XLFDT(NOW),"@",2)
+29 SET $PIECE(KMPDY(0),U,2)=$$FMDIFF^XLFDT(NOW,KMPDSTM,3)
+30 SET $PIECE(KMPDY(0),U,3)=$SELECT($PIECE(DATA,U):$PIECE(DATA,U),1:10)
+31 SET $PIECE(KMPDY(0),U,4)=$SELECT($PIECE(DATA,U,2):$PIECE(DATA,U,2),1:30)
+32 SET $PIECE(KMPDY(0),U,5)=KMPDSTM
+33 ;
+34 SET LN=0
+35 FOR I=0:0
SET I=$ORDER(KMPUTMP(I))
if 'I
QUIT
Begin DoDot:1
+36 SET LN=LN+1
SET KMPDY(LN)=$GET(KMPUTMP(I,0))
End DoDot:1
+37 ;
+38 QUIT
+39 ;
TMGRPT(KMPDY,KMPDRPT,KMPDTM,KMPDATE,KMPDSRCH,KMPDTSEC,KMPDHOUR) ;-- rpc - timing reports
+1 ;-------------------------------------------------------------------
+2 ; KMPDY()... array containing report
+3 ; KMPDRPT... report name (free text)
+4 ; KMPDTM.... time frame - prime time or non-prime time
+5 ; KMPDATE... date (fileman format)
+6 ; KMPDSRCH.. ttl search text
+7 ; 1: User Name
+8 ; 2: Client Name
+9 ; 3: IP Address
+10 ; 4: All Items
+11 ; KMPDTSEC.. seconds
+12 ; KMPDTHR... hour
+13 ;-------------------------------------------------------------------
+14 ;
+15 KILL KMPDY
+16 ;
+17 SET KMPDRPT=$GET(KMPDRPT)
+18 IF KMPDRPT=""
SET KMPDY(0)="[There is no Report Name]"
QUIT
+19 SET KMPDTM=$GET(KMPDTM)
+20 IF KMPDTM=""
SET KMPDY(0)="[There is no Time Frame]"
QUIT
+21 IF '$DATA(KMPDATE)
SET KMPDY(0)="[There is no Ending Date]"
QUIT
+22 ;
+23 NEW DATA,DATE,HR,I,KMPDPTNP,LN
+24 ;
+25 KILL ^TMP($JOB)
+26 ;
+27 IF KMPDRPT="TMG - Average Daily Coversheet Load"
DO ADCL^KMPDU7A
+28 IF KMPDRPT="TMG - Average Hourly Coversheet Load"
DO AHCR^KMPDU7A
+29 IF KMPDRPT="TMG - Coversheet TTL Alert Report"
DO CTTLAR^KMPDU7A
+30 IF KMPDRPT="TMG - Daily Coversheet TTL Detailed Report"
DO DCTTLDR^KMPDU7A
+31 IF KMPDRPT="TMG - Hourly Coversheet TTL Detailed Report"
DO HCTTLDR^KMPDU7A
+32 IF KMPDRPT="TMG - Real-Time Average Hourly Coversheet Load"
DO RTAHCL^KMPDU7A
+33 IF KMPDRPT="TMG - Real-Time Threshold Alert"
DO RTTA^KMPDU7A
+34 ;
+35 if '$DATA(KMPDY)
SET KMPDY(0)="<No Data to Report>"
+36 ;
+37 QUIT
+38 ;
TMGSST(KMPDY,KMPDSST) ;-- rpc - start/stop timing monitor
+1 ;-------------------------------------------------------------------
+2 ; KMPDY()... array containing timing monitor status
+3 ; 0 - timing monitor is off
+4 ; 1 - timing monitor is on
+5 ; KMPSST.... start/stop
+6 ; 0 - stop timing monitor
+7 ; 1 - start timing monitor
+8 ;-------------------------------------------------------------------
+9 ;
+10 SET KMPDSST=+$GET(KMPDSST)
+11 if KMPDSST>1
SET KMPDSST=1
+12 SET ^KMPTMP("KMPD-CPRS")=KMPDSST
+13 SET KMPDY(0)=KMPDSST
+14 QUIT
+15 ;
TMGSTAT(KMPDY) ;-- rpc - timing monitor status
+1 ;-------------------------------------------------------------------
+2 ; KMPDY()... array containing timing monitor status
+3 ; 0 - timing monitor is off
+4 ; 1 - timing monitor is on
+5 ;-------------------------------------------------------------------
+6 ;
+7 SET KMPDY(0)=$GET(^KMPTMP("KMPD-CPRS"))
+8 ;
+9 QUIT