KMPRUTL2 ;SFISC/RAK - RUM Data for All Nodes (Graph) ;22 Oct 1998
;;1.0;CAPACITY MANAGEMENT - RUM;;Dec 09, 1998
;
ELEMDATA(KMPRELMT,KMPRST,KMPREN,KMPRNODE,KMPRARRY,KMPRQIET) ;-- elements
; compile rum element stats.
;-----------------------------------------------------------------------
; KMPRELMT... Element. This represents the ^piece of where the
; element data is located in file 8971.1.
; Example: 5 would be piece 5 of node 1 - M COMMANDS (PT)
; or piece 5 of node 2 - M COMMANDS (NP)
; KMPRST..... Start date in internal fileman format.
; KMPREN..... End date in internal fileman format.
; KMPRNODE... Array (passed by reference) containing name of nodes to
; process in format: KMPRNODE("NODENAME")=""
; KMPRARRY... Array (passed by value) that will contain results of
; search in format:
; KMPRARRY(KMPRNODE,DATE)=element/per second
; where DATE will be in internal filemat format.
; KMPRQIET... Output date/dots during search.
; 0 - not quiet.
; 1 - quiet.
;-----------------------------------------------------------------------
;
Q:'$G(KMPRELMT)
Q:'$G(KMPRST)
Q:'$G(KMPREN)
Q:'$D(KMPRNODE)
Q:$G(KMPRARRY)=""
S KMPRQIET=+$G(KMPRQIET)
;
K @KMPRARRY
;
N DATE,DATA,DCOUNT,END,IEN,NODE,OCCURR,OPTION,START
;
; DATE.... Current date being processed.
; END..... Ending date.
; NODE.... Computer node.
; OCCURR.. # of Occurrences
; OPTION.. Option name.
; START... Starting date.
;
S END=KMPREN,START=KMPRST
S DATE=START-.1,OCCURR=0
F S DATE=$O(^KMPR(8971.1,"B",DATE)) Q:'DATE!(DATE>END) D
.I 'KMPRQIET W:$X>68 !?23 W $$FMTE^XLFDT(DATE,5),"."
.S IEN=0
.F S IEN=$O(^KMPR(8971.1,"B",DATE,IEN)) Q:'IEN D
..I 'KMPRQIET&('(IEN#1000)) W:$X>78 !?23 W "."
..Q:'$D(^KMPR(8971.1,IEN,0)) S DATA(0)=^(0),DATA(1)=$G(^(1)),DATA(2)=$G(^(2))
..S NODE=$P(DATA(0),U,3) Q:NODE=""
..Q:'$D(KMPRNODE(NODE))
..S @KMPRARRY@(NODE,DATE)=$G(@KMPRARRY@(NODE,DATE))+$P(DATA(1),U,+KMPRELMT)
..S @KMPRARRY@(NODE,DATE)=$G(@KMPRARRY@(NODE,DATE))+$P(DATA(2),U,+KMPRELMT)
..; count occurrences.
..S OCCURR=OCCURR+$P(DATA(1),U,8)+$P(DATA(2),U,8)
;
; calculate element per second or per occurrence.
S NODE=""
F S NODE=$O(@KMPRARRY@(NODE)) Q:NODE="" S DATE="" D
.F S DATE=$O(@KMPRARRY@(NODE,DATE)) Q:'DATE D
..; elements 1 and 7 are per Occurrence.
..I KMPRELMT=1!(KMPRELMT=7) D
...S @KMPRARRY@(NODE,DATE)=$FN(@KMPRARRY@(NODE,DATE)/(OCCURR),"",2)
..; all other elements are per second.
..E S @KMPRARRY@(NODE,DATE)=$FN(@KMPRARRY@(NODE,DATE)/(24*3600),"",2)
;
Q
;
PKGDATA(KMPRPKG,KMPRSTR,KMPREND,KMPRARRY,KMPRQIET) ;-- package data.
;-----------------------------------------------------------------------
; KMPRPKG... Package name (case sensitive, free text).
; KMPRSTR... Start date in internal fileman format.
; KMPREND... End date in internal fileman format.
; KMPRARRY.. Array to hold data (by value).
; KMPRQIET.. Output date/dots during search.
; 0 - not quiet.
; 1 - quiet.
;-----------------------------------------------------------------------
;
Q:$G(KMPRPKG)=""!($G(KMPRPKG)="^")
Q:'$G(KMPRSTR)
Q:'$G(KMPREND)
Q:$G(KMPRARRY)=""
S KMPRQIET=+$G(KMPRQIET)
;
N DATE,DESIG,HL7,I,IEN,NODE,OPTION,PROTOCOL,RPC,TOTALS,TYP
;
S DATE=KMPRSTR-.1
F S DATE=$O(^KMPR(8971.1,"B",DATE)) Q:'DATE!(DATE>KMPREND) S IEN=0 D
.I 'KMPRQIET W:$X>68 !?23 W $$FMTE^XLFDT(DATE,5),"."
.F S IEN=$O(^KMPR(8971.1,"B",DATE,IEN)) Q:'IEN D
..I 'KMPRQIET&('(IEN#1000)) W:$X>78 !?23 W "."
..Q:'$D(^KMPR(8971.1,IEN,0)) S DATA(0)=^(0),DATA(1)=$G(^(1)),DATA(2)=$G(^(2))
..S NODE=$P(DATA(0),U,3) S:NODE="" NODE="N/A"
..S OPTION=$P(DATA(0),U,4) S:OPTION="" OPTION="N/A"
..S PROTOCOL=$P(DATA(0),U,5)
..S RPC=$P(DATA(0),U,7)
..S HL7=$P(DATA(0),U,9)
..; rum designation: 1 - TASKMAN
..; 2 - USER
..; 3 - BROKER
..; 4 - HL7
..; 5 OTHER
..S DESIG=$P(DATA(0),U,8)
..;
..; TYP: KMPRPKG. options within namespace
..; HL7..... hl7 within namespace.
..; RPC..... rpc within namespace
..; PRTCL... protocol within namespace
..; TASK.... tasked option within namespace
..; OTH..... all other options/protocols
..;
..S TYP="OTH"
..; if option is in namespace.
..I $E(OPTION,1,$L(KMPRPKG))=KMPRPKG S TYP=KMPRPKG
..; if option in namespace and protocol was called.
..I TYP=KMPRPKG I PROTOCOL]"" S TYP="PRTCL"
..; if option in namespace and tasked.
..I TYP=KMPRPKG&(DESIG=1)&($E(OPTION,1,$L(KMPRPKG))=KMPRPKG) S TYP="TASK"
..; if broker and in namespace.
..I DESIG=3&($E(RPC,1,$L(KMPRPKG))=KMPRPKG) S TYP="RPC"
..; if hl7 and in namespace.
..I DESIG=4&($E(HL7,1,$L(KMPRPKG))=KMPRPKG) S TYP="HL7"
..; get current totals (if any).
..S TOTALS=$G(@KMPRARRY@(NODE,TYP))
..; add prime time and non-prime time totals
..F I=1:1:8 D
...S $P(@KMPRARRY@(NODE,TYP),U,I)=$P($G(@KMPRARRY@(NODE,TYP)),U,I)+$P(DATA(1),U,I)
...S $P(@KMPRARRY@(NODE,TYP),U,I)=$P($G(@KMPRARRY@(NODE,TYP)),U,I)+$P(DATA(2),U,I)
...S $P(@KMPRARRY@(NODE,"TOTALS"),U,I)=$P($G(@KMPRARRY@(NODE,"TOTALS")),U,I)+$P(DATA(1),U,I)
...S $P(@KMPRARRY@(NODE,"TOTALS"),U,I)=$P($G(@KMPRARRY@(NODE,"TOTALS")),U,I)+$P(DATA(2),U,I)
;
Q
KMPRUTL2 ;SFISC/RAK - RUM Data for All Nodes (Graph) ;22 Oct 1998
+1 ;;1.0;CAPACITY MANAGEMENT - RUM;;Dec 09, 1998
+2 ;
ELEMDATA(KMPRELMT,KMPRST,KMPREN,KMPRNODE,KMPRARRY,KMPRQIET) ;-- elements
+1 ; compile rum element stats.
+2 ;-----------------------------------------------------------------------
+3 ; KMPRELMT... Element. This represents the ^piece of where the
+4 ; element data is located in file 8971.1.
+5 ; Example: 5 would be piece 5 of node 1 - M COMMANDS (PT)
+6 ; or piece 5 of node 2 - M COMMANDS (NP)
+7 ; KMPRST..... Start date in internal fileman format.
+8 ; KMPREN..... End date in internal fileman format.
+9 ; KMPRNODE... Array (passed by reference) containing name of nodes to
+10 ; process in format: KMPRNODE("NODENAME")=""
+11 ; KMPRARRY... Array (passed by value) that will contain results of
+12 ; search in format:
+13 ; KMPRARRY(KMPRNODE,DATE)=element/per second
+14 ; where DATE will be in internal filemat format.
+15 ; KMPRQIET... Output date/dots during search.
+16 ; 0 - not quiet.
+17 ; 1 - quiet.
+18 ;-----------------------------------------------------------------------
+19 ;
+20 IF '$GET(KMPRELMT)
QUIT
+21 IF '$GET(KMPRST)
QUIT
+22 IF '$GET(KMPREN)
QUIT
+23 IF '$DATA(KMPRNODE)
QUIT
+24 IF $GET(KMPRARRY)=""
QUIT
+25 SET KMPRQIET=+$GET(KMPRQIET)
+26 ;
+27 KILL @KMPRARRY
+28 ;
+29 NEW DATE,DATA,DCOUNT,END,IEN,NODE,OCCURR,OPTION,START
+30 ;
+31 ; DATE.... Current date being processed.
+32 ; END..... Ending date.
+33 ; NODE.... Computer node.
+34 ; OCCURR.. # of Occurrences
+35 ; OPTION.. Option name.
+36 ; START... Starting date.
+37 ;
+38 SET END=KMPREN
SET START=KMPRST
+39 SET DATE=START-.1
SET OCCURR=0
+40 FOR
SET DATE=$ORDER(^KMPR(8971.1,"B",DATE))
IF 'DATE!(DATE>END)
QUIT
Begin DoDot:1
+41 IF 'KMPRQIET
IF $X>68
WRITE !?23
WRITE $$FMTE^XLFDT(DATE,5),"."
+42 SET IEN=0
+43 FOR
SET IEN=$ORDER(^KMPR(8971.1,"B",DATE,IEN))
IF 'IEN
QUIT
Begin DoDot:2
+44 IF 'KMPRQIET&('(IEN#1000))
IF $X>78
WRITE !?23
WRITE "."
+45 IF '$DATA(^KMPR(8971.1,IEN,0))
QUIT
SET DATA(0)=^(0)
SET DATA(1)=$GET(^(1))
SET DATA(2)=$GET(^(2))
+46 SET NODE=$PIECE(DATA(0),U,3)
IF NODE=""
QUIT
+47 IF '$DATA(KMPRNODE(NODE))
QUIT
+48 SET @KMPRARRY@(NODE,DATE)=$GET(@KMPRARRY@(NODE,DATE))+$PIECE(DATA(1),U,+KMPRELMT)
+49 SET @KMPRARRY@(NODE,DATE)=$GET(@KMPRARRY@(NODE,DATE))+$PIECE(DATA(2),U,+KMPRELMT)
+50 ; count occurrences.
+51 SET OCCURR=OCCURR+$PIECE(DATA(1),U,8)+$PIECE(DATA(2),U,8)
End DoDot:2
End DoDot:1
+52 ;
+53 ; calculate element per second or per occurrence.
+54 SET NODE=""
+55 FOR
SET NODE=$ORDER(@KMPRARRY@(NODE))
IF NODE=""
QUIT
SET DATE=""
Begin DoDot:1
+56 FOR
SET DATE=$ORDER(@KMPRARRY@(NODE,DATE))
IF 'DATE
QUIT
Begin DoDot:2
+57 ; elements 1 and 7 are per Occurrence.
+58 IF KMPRELMT=1!(KMPRELMT=7)
Begin DoDot:3
+59 SET @KMPRARRY@(NODE,DATE)=$FNUMBER(@KMPRARRY@(NODE,DATE)/(OCCURR),"",2)
End DoDot:3
+60 ; all other elements are per second.
+61 IF '$TEST
SET @KMPRARRY@(NODE,DATE)=$FNUMBER(@KMPRARRY@(NODE,DATE)/(24*3600),"",2)
End DoDot:2
End DoDot:1
+62 ;
+63 QUIT
+64 ;
PKGDATA(KMPRPKG,KMPRSTR,KMPREND,KMPRARRY,KMPRQIET) ;-- package data.
+1 ;-----------------------------------------------------------------------
+2 ; KMPRPKG... Package name (case sensitive, free text).
+3 ; KMPRSTR... Start date in internal fileman format.
+4 ; KMPREND... End date in internal fileman format.
+5 ; KMPRARRY.. Array to hold data (by value).
+6 ; KMPRQIET.. Output date/dots during search.
+7 ; 0 - not quiet.
+8 ; 1 - quiet.
+9 ;-----------------------------------------------------------------------
+10 ;
+11 IF $GET(KMPRPKG)=""!($GET(KMPRPKG)="^")
QUIT
+12 IF '$GET(KMPRSTR)
QUIT
+13 IF '$GET(KMPREND)
QUIT
+14 IF $GET(KMPRARRY)=""
QUIT
+15 SET KMPRQIET=+$GET(KMPRQIET)
+16 ;
+17 NEW DATE,DESIG,HL7,I,IEN,NODE,OPTION,PROTOCOL,RPC,TOTALS,TYP
+18 ;
+19 SET DATE=KMPRSTR-.1
+20 FOR
SET DATE=$ORDER(^KMPR(8971.1,"B",DATE))
IF 'DATE!(DATE>KMPREND)
QUIT
SET IEN=0
Begin DoDot:1
+21 IF 'KMPRQIET
IF $X>68
WRITE !?23
WRITE $$FMTE^XLFDT(DATE,5),"."
+22 FOR
SET IEN=$ORDER(^KMPR(8971.1,"B",DATE,IEN))
IF 'IEN
QUIT
Begin DoDot:2
+23 IF 'KMPRQIET&('(IEN#1000))
IF $X>78
WRITE !?23
WRITE "."
+24 IF '$DATA(^KMPR(8971.1,IEN,0))
QUIT
SET DATA(0)=^(0)
SET DATA(1)=$GET(^(1))
SET DATA(2)=$GET(^(2))
+25 SET NODE=$PIECE(DATA(0),U,3)
IF NODE=""
SET NODE="N/A"
+26 SET OPTION=$PIECE(DATA(0),U,4)
IF OPTION=""
SET OPTION="N/A"
+27 SET PROTOCOL=$PIECE(DATA(0),U,5)
+28 SET RPC=$PIECE(DATA(0),U,7)
+29 SET HL7=$PIECE(DATA(0),U,9)
+30 ; rum designation: 1 - TASKMAN
+31 ; 2 - USER
+32 ; 3 - BROKER
+33 ; 4 - HL7
+34 ; 5 OTHER
+35 SET DESIG=$PIECE(DATA(0),U,8)
+36 ;
+37 ; TYP: KMPRPKG. options within namespace
+38 ; HL7..... hl7 within namespace.
+39 ; RPC..... rpc within namespace
+40 ; PRTCL... protocol within namespace
+41 ; TASK.... tasked option within namespace
+42 ; OTH..... all other options/protocols
+43 ;
+44 SET TYP="OTH"
+45 ; if option is in namespace.
+46 IF $EXTRACT(OPTION,1,$LENGTH(KMPRPKG))=KMPRPKG
SET TYP=KMPRPKG
+47 ; if option in namespace and protocol was called.
+48 IF TYP=KMPRPKG
IF PROTOCOL]""
SET TYP="PRTCL"
+49 ; if option in namespace and tasked.
+50 IF TYP=KMPRPKG&(DESIG=1)&($EXTRACT(OPTION,1,$LENGTH(KMPRPKG))=KMPRPKG)
SET TYP="TASK"
+51 ; if broker and in namespace.
+52 IF DESIG=3&($EXTRACT(RPC,1,$LENGTH(KMPRPKG))=KMPRPKG)
SET TYP="RPC"
+53 ; if hl7 and in namespace.
+54 IF DESIG=4&($EXTRACT(HL7,1,$LENGTH(KMPRPKG))=KMPRPKG)
SET TYP="HL7"
+55 ; get current totals (if any).
+56 SET TOTALS=$GET(@KMPRARRY@(NODE,TYP))
+57 ; add prime time and non-prime time totals
+58 FOR I=1:1:8
Begin DoDot:3
+59 SET $PIECE(@KMPRARRY@(NODE,TYP),U,I)=$PIECE($GET(@KMPRARRY@(NODE,TYP)),U,I)+$PIECE(DATA(1),U,I)
+60 SET $PIECE(@KMPRARRY@(NODE,TYP),U,I)=$PIECE($GET(@KMPRARRY@(NODE,TYP)),U,I)+$PIECE(DATA(2),U,I)
+61 SET $PIECE(@KMPRARRY@(NODE,"TOTALS"),U,I)=$PIECE($GET(@KMPRARRY@(NODE,"TOTALS")),U,I)+$PIECE(DATA(1),U,I)
+62 SET $PIECE(@KMPRARRY@(NODE,"TOTALS"),U,I)=$PIECE($GET(@KMPRARRY@(NODE,"TOTALS")),U,I)+$PIECE(DATA(2),U,I)
End DoDot:3
End DoDot:2
End DoDot:1
+63 ;
+64 QUIT