source: FOIAVistA/trunk/r/CAPACITY_MANAGEMENT_TOOLS-KMPD-KMPL/KMPDUTL7.m@ 1354

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

initial load of FOIAVistA 6/30/08 version

File size: 4.8 KB
Line 
1KMPDUTL7 ;OAK/RAK - CM Tools Utility ;2/17/04 10:52
2 ;;2.0;CAPACITY MANAGEMENT TOOLS;**2,5**;Mar 22, 2002
3 ;
4RSTART(KMPDIEN) ;-- start routine statistics
5 ;-----------------------------------------------------------------------
6 ; KMPDIEN.... Ien for file #8972.1 (CM CODE EVALUATOR).
7 ;-----------------------------------------------------------------------
8 Q:'$G(KMPDIEN)
9 Q:'$D(^KMPD(8972.1,+KMPDIEN,0))#5
10 ; quit if not 'active'
11 Q:'$P($G(^KMPD(8972.1,+KMPDIEN,0)),U,11)
12 K KMPDU(KMPDIEN)
13 S KMPDU(KMPDIEN,"START")=$$STATS^%ZOSVKR
14 Q
15 ;
16RSTOP(KMPDIEN) ;-- stop routine statistics
17 ;-----------------------------------------------------------------------
18 ; KMPDIEN.... Ien for file #8972.1 (CM CODE EVALUATOR).
19 ;-----------------------------------------------------------------------
20 Q:'$G(KMPDIEN)
21 Q:'$D(^KMPD(8972.1,+KMPDIEN,0))#5
22 ; quit if no 'start' subscript
23 Q:'$D(KMPDU(KMPDIEN,"START"))
24 ; quit if not 'active'
25 Q:'$P($G(^KMPD(8972.1,+KMPDIEN,0)),U,11)
26 ;
27 N ARRAY,I,OVERHEAD,ZIEN
28 ;
29 S KMPDU(KMPDIEN,"STOP")=$$STATS^%ZOSVKR
30 F I=1:1:6 D
31 .; check for negative numbers
32 .S $P(KMPDU(KMPDIEN,"START"),U,I)=$$NUMBER($P(KMPDU(KMPDIEN,"START"),U,I))
33 .S $P(KMPDU(KMPDIEN,"STOP"),U,I)=$$NUMBER($P(KMPDU(KMPDIEN,"STOP"),U,I))
34 .; calculate difference
35 .S $P(KMPDU(KMPDIEN,"DIFF"),U,I)=$P(KMPDU(KMPDIEN,"STOP"),U,I)-$P(KMPDU(KMPDIEN,"START"),U,I)
36 .; check 'difference' for negative number
37 .S $P(KMPDU(KMPDIEN,"DIFF"),U,I)=$$NUMBER($P(KMPDU(KMPDIEN,"DIFF"),U,I))
38 ;
39 ; get overhead data.
40 S OVERHEAD=$$GETROVHD
41 ; subtract overhead data from "DIFF".
42 F I=1:1:6 D
43 .S $P(KMPDU(KMPDIEN,"DIFF"),U,I)=$P(KMPDU(KMPDIEN,"DIFF"),U,I)-$P(OVERHEAD,U,I)
44 ;
45 ; file results
46 ; elements.
47 F I=1:1:6 S ARRAY((I+3)*.01)=$P(KMPDU(KMPDIEN,"DIFF"),U,I)
48 ; file data
49 D EDIT^KMPDUTL8(KMPDIEN,"ARRAY")
50 ;
51 K KMPDU(KMPDIEN)
52 ;
53 Q
54 ;
55CONVERT(KMPDTEXT) ;-- extrinsic function - convert disallowed character(s)
56 ;-----------------------------------------------------------------------
57 ; KMPDTEXT.. Text to convert.
58 ; '^' will be converted to '~'
59 ;-----------------------------------------------------------------------
60 ;
61 S KMPDTEXT=$TR(KMPDTEXT,"^","~")
62 Q $E(KMPDTEXT,1,30)
63 ;
64GETROVHD() ;-- extrinsic - get routine overhead stats.
65 ;-----------------------------------------------------------------------
66 ; Return: overhead data in 9 up-arrow (^) pieces:
67 ; piece 1 - CPU Time
68 ; piece 2 - DIO References
69 ; piece 3 - BIO References
70 ; piece 4 - Page Faults
71 ; piece 5 - M Commands
72 ; piece 6 - GLO References
73 ; piece 7 - $H Day
74 ; piece 8 - $H Seconds
75 ; piece 9 - ASCII Date/Time
76 ;-----------------------------------------------------------------------
77 ;
78 D:$G(^XTMP("KMPD","ROVHD"))="" ROVHD
79 Q $G(^XTMP("KMPD","ROVHD"))
80 ;
81ROVHD ;-- calculate overhead for routine stats.
82 ;
83 ; This sub-routine determines the overhead for elements when running
84 ; RSTART^KMPDUTL1 and RSTOP^KMPDUTL1. The overhead numbers are stored
85 ; in ^XTMP("KMPD","ROHD"), and are subtracted from the final numbers
86 ; to get as true a picture as possible of the actual elements for the
87 ; calling routine.
88 ;
89 N DIFF,I,START,STOP
90 S DIFF=""
91 S START=$$STATS^%ZOSVKR
92 S STOP=$$STATS^%ZOSVKR
93 F I=1:1:6 D
94 .S $P(DIFF,U,I)=$P(STOP,U,I)-$P(START,U,I)
95 ; m commands.
96 S $P(DIFF,U,5)=$P(DIFF,U,5)+8
97 ; glo references.
98 S $P(DIFF,U,6)=$P(DIFF,U,6)+2
99 S ^XTMP("KMPD",0)=$$FMADD^XLFDT($$DT^XLFDT,300)
100 S ^XTMP("KMPD","ROVHD")=DIFF
101 ;
102 Q
103 ;
104NUMBER(KMPDNUM) ;-- extrinsic function - check for negative numbers
105 ;-----------------------------------------------------------------------
106 ; KMPDNUM... Number to be checked
107 ;
108 ; Return: non-negative number
109 ;
110 ; Because certain data elements (such as m commands and global
111 ; references) can grow to such large numbers, these numbers must be
112 ; checked. If they have become negative (the register flips) they
113 ; can be turned into positive numbers with
114 ;-----------------------------------------------------------------------
115 ;
116 S KMPDNUM=$G(KMPDNUM)
117 Q:KMPDNUM="" KMPDNUM
118 Q:KMPDNUM'<0 KMPDNUM
119 Q KMPDNUM+(2**32)
120 ;
121TRANSTO(KMPDIEN,KMPDAPP,KMPDRES) ;-- return 'transmit to' for data transmission
122 ;-----------------------------------------------------------------------
123 ; KMPDIEN.... Ien for file #8973 (CP PARAMETERS)
124 ; KMPDAPP.... Application:
125 ; 1 = sagg
126 ; 2 = rum
127 ; 3 = hl7
128 ; 4 = timing
129 ; 5 = vista monitor
130 ; KMPDRES().. Results array in format:
131 ; KMPDRES(ExternalFormat)=IEN
132 ; KMPDRES(... )=IEN
133 ;-----------------------------------------------------------------------
134 ;
135 K KMPDRES
136 Q:'$G(KMPDIEN)
137 Q:'$D(^KMPD(8973,KMPDIEN,0))
138 Q:'$G(KMPDAPP)
139 Q:KMPDAPP<1!(KMPDAPP>5)
140 ;
141 N DATA,I,NODE
142 ;
143 S NODE=21+(KMPDAPP*.1),I=0
144 F S I=$O(^KMPD(8973,KMPDIEN,NODE,I)) Q:'I D
145 .Q:'$D(^KMPD(8973,KMPDIEN,NODE,I,0)) S DATA=^(0)
146 .S KMPDRES(DATA)=I
147 ;
148 Q
Note: See TracBrowser for help on using the repository browser.