source: FOIAVistA/trunk/r/CAPACITY_MANAGEMENT_RUM-KMPR/KMPRUTL2.m@ 957

Last change on this file since 957 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 5.2 KB
Line 
1KMPRUTL2 ;OAK/RAK - RUM Data for All Nodes (Graph) ;5/28/03 09:15
2 ;;2.0;CAPACITY MANAGEMENT - RUM;;May 28, 2003
3 ;
4ELEMDATA(KMPRELMT,KMPRST,KMPREN,KMPRNODE,KMPRARRY,KMPRQIET) ;-- elements
5 ; compile rum element stats.
6 ;-----------------------------------------------------------------------
7 ; KMPRELMT... Element. This represents the ^piece of where the
8 ; element data is located in file 8971.1.
9 ; Example: 5 would be piece 5 of node 1 - M COMMANDS (PT)
10 ; or piece 5 of node 2 - M COMMANDS (NP)
11 ; KMPRST..... Start date in internal fileman format.
12 ; KMPREN..... End date in internal fileman format.
13 ; KMPRNODE... Array (passed by reference) containing name of nodes to
14 ; process in format: KMPRNODE("NODENAME")=""
15 ; KMPRARRY... Array (passed by value) that will contain results of
16 ; search in format:
17 ; KMPRARRY(KMPRNODE,DATE)=element/per second
18 ; where DATE will be in internal filemat format.
19 ; KMPRQIET... Output date/dots during search.
20 ; 0 - not quiet.
21 ; 1 - quiet.
22 ;-----------------------------------------------------------------------
23 ;
24 Q:'$G(KMPRELMT)
25 Q:'$G(KMPRST)
26 Q:'$G(KMPREN)
27 Q:'$D(KMPRNODE)
28 Q:$G(KMPRARRY)=""
29 S KMPRQIET=+$G(KMPRQIET)
30 ;
31 K @KMPRARRY
32 ;
33 N DATE,DATA,DCOUNT,END,IEN,NODE,OCCURR,OPTION,START
34 ;
35 ; DATE.... Current date being processed.
36 ; END..... Ending date.
37 ; NODE.... Computer node.
38 ; OCCURR.. # of Occurrences
39 ; OPTION.. Option name.
40 ; START... Starting date.
41 ;
42 S END=KMPREN,START=KMPRST
43 S DATE=START-.1,OCCURR=0
44 F S DATE=$O(^KMPR(8971.1,"B",DATE)) Q:'DATE!(DATE>END) D
45 .I 'KMPRQIET W:$X>68 !?23 W $$FMTE^XLFDT(DATE,5),"."
46 .S IEN=0
47 .F S IEN=$O(^KMPR(8971.1,"B",DATE,IEN)) Q:'IEN D
48 ..I 'KMPRQIET&('(IEN#1000)) W:$X>78 !?23 W "."
49 ..Q:'$D(^KMPR(8971.1,IEN,0)) S DATA(0)=^(0),DATA(1)=$G(^(1)),DATA(2)=$G(^(2))
50 ..S NODE=$P(DATA(0),U,3) Q:NODE=""
51 ..Q:'$D(KMPRNODE(NODE))
52 ..S @KMPRARRY@(NODE,DATE)=$G(@KMPRARRY@(NODE,DATE))+$P(DATA(1),U,+KMPRELMT)
53 ..S @KMPRARRY@(NODE,DATE)=$G(@KMPRARRY@(NODE,DATE))+$P(DATA(2),U,+KMPRELMT)
54 ..; count occurrences.
55 ..S OCCURR=OCCURR+$P(DATA(1),U,8)+$P(DATA(2),U,8)
56 ;
57 ; calculate element per second or per occurrence.
58 S NODE=""
59 F S NODE=$O(@KMPRARRY@(NODE)) Q:NODE="" S DATE="" D
60 .F S DATE=$O(@KMPRARRY@(NODE,DATE)) Q:'DATE D
61 ..; elements 1 and 7 are per Occurrence.
62 ..I KMPRELMT=1!(KMPRELMT=7) D
63 ...S @KMPRARRY@(NODE,DATE)=$FN(@KMPRARRY@(NODE,DATE)/(OCCURR),"",2)
64 ..; all other elements are per second.
65 ..E S @KMPRARRY@(NODE,DATE)=$FN(@KMPRARRY@(NODE,DATE)/(24*3600),"",2)
66 ;
67 Q
68 ;
69PKGDATA(KMPRPKG,KMPRSTR,KMPREND,KMPRARRY,KMPRQIET) ;-- package data.
70 ;-----------------------------------------------------------------------
71 ; KMPRPKG... Package name (case sensitive, free text).
72 ; KMPRSTR... Start date in internal fileman format.
73 ; KMPREND... End date in internal fileman format.
74 ; KMPRARRY.. Array to hold data (by value).
75 ; KMPRQIET.. Output date/dots during search.
76 ; 0 - not quiet.
77 ; 1 - quiet.
78 ;-----------------------------------------------------------------------
79 ;
80 Q:$G(KMPRPKG)=""!($G(KMPRPKG)="^")
81 Q:'$G(KMPRSTR)
82 Q:'$G(KMPREND)
83 Q:$G(KMPRARRY)=""
84 S KMPRQIET=+$G(KMPRQIET)
85 ;
86 N DATE,DESIG,HL7,I,IEN,NODE,OPTION,PROTOCOL,RPC,TOTALS,TYP
87 ;
88 S DATE=KMPRSTR-.1
89 F S DATE=$O(^KMPR(8971.1,"B",DATE)) Q:'DATE!(DATE>KMPREND) S IEN=0 D
90 .I 'KMPRQIET W:$X>68 !?23 W $$FMTE^XLFDT(DATE,5),"."
91 .F S IEN=$O(^KMPR(8971.1,"B",DATE,IEN)) Q:'IEN D
92 ..I 'KMPRQIET&('(IEN#1000)) W:$X>78 !?23 W "."
93 ..Q:'$D(^KMPR(8971.1,IEN,0)) S DATA(0)=^(0),DATA(1)=$G(^(1)),DATA(2)=$G(^(2))
94 ..S NODE=$P(DATA(0),U,3) S:NODE="" NODE="N/A"
95 ..S OPTION=$P(DATA(0),U,4) S:OPTION="" OPTION="N/A"
96 ..S PROTOCOL=$P(DATA(0),U,5)
97 ..S RPC=$P(DATA(0),U,7)
98 ..S HL7=$P(DATA(0),U,9)
99 ..; rum designation: 1 - TASKMAN
100 ..; 2 - USER
101 ..; 3 - BROKER
102 ..; 4 - HL7
103 ..; 5 OTHER
104 ..S DESIG=$P(DATA(0),U,8)
105 ..;
106 ..; TYP: KMPRPKG. options within namespace
107 ..; HL7..... hl7 within namespace.
108 ..; RPC..... rpc within namespace
109 ..; PRTCL... protocol within namespace
110 ..; TASK.... tasked option within namespace
111 ..; OTH..... all other options/protocols
112 ..;
113 ..S TYP="OTH"
114 ..; if option is in namespace.
115 ..I $E(OPTION,1,$L(KMPRPKG))=KMPRPKG S TYP=KMPRPKG
116 ..; if option in namespace and protocol was called.
117 ..I TYP=KMPRPKG I PROTOCOL]"" S TYP="PRTCL"
118 ..; if option in namespace and tasked.
119 ..I TYP=KMPRPKG&(DESIG=1)&($E(OPTION,1,$L(KMPRPKG))=KMPRPKG) S TYP="TASK"
120 ..; if broker and in namespace.
121 ..I DESIG=3&($E(RPC,1,$L(KMPRPKG))=KMPRPKG) S TYP="RPC"
122 ..; if hl7 and in namespace.
123 ..I DESIG=4&($E(HL7,1,$L(KMPRPKG))=KMPRPKG) S TYP="HL7"
124 ..; get current totals (if any).
125 ..S TOTALS=$G(@KMPRARRY@(NODE,TYP))
126 ..; add prime time and non-prime time totals
127 ..F I=1:1:8 D
128 ...S $P(@KMPRARRY@(NODE,TYP),U,I)=$P($G(@KMPRARRY@(NODE,TYP)),U,I)+$P(DATA(1),U,I)
129 ...S $P(@KMPRARRY@(NODE,TYP),U,I)=$P($G(@KMPRARRY@(NODE,TYP)),U,I)+$P(DATA(2),U,I)
130 ...S $P(@KMPRARRY@(NODE,"TOTALS"),U,I)=$P($G(@KMPRARRY@(NODE,"TOTALS")),U,I)+$P(DATA(1),U,I)
131 ...S $P(@KMPRARRY@(NODE,"TOTALS"),U,I)=$P($G(@KMPRARRY@(NODE,"TOTALS")),U,I)+$P(DATA(2),U,I)
132 ;
133 Q
Note: See TracBrowser for help on using the repository browser.