- KMPDUTL7 ;OAK/RAK - CM Tools Utility ;2/17/04 10:52
- ;;3.0;KMPD;;Jan 22, 2009;Build 42
- ;
- RSTART(KMPDIEN) ;-- start routine statistics
- ;-----------------------------------------------------------------------
- ; KMPDIEN.... Ien for file #8972.1 (CM CODE EVALUATOR).
- ;-----------------------------------------------------------------------
- Q:'$G(KMPDIEN)
- Q:'$D(^KMPD(8972.1,+KMPDIEN,0))#5
- ; quit if not 'active'
- Q:'$P($G(^KMPD(8972.1,+KMPDIEN,0)),U,11)
- K KMPDU(KMPDIEN)
- S KMPDU(KMPDIEN,"START")=$$STATS^%ZOSVKR
- Q
- ;
- RSTOP(KMPDIEN) ;-- stop routine statistics
- ;-----------------------------------------------------------------------
- ; KMPDIEN.... Ien for file #8972.1 (CM CODE EVALUATOR).
- ;-----------------------------------------------------------------------
- Q:'$G(KMPDIEN)
- Q:'$D(^KMPD(8972.1,+KMPDIEN,0))#5
- ; quit if no 'start' subscript
- Q:'$D(KMPDU(KMPDIEN,"START"))
- ; quit if not 'active'
- Q:'$P($G(^KMPD(8972.1,+KMPDIEN,0)),U,11)
- ;
- N ARRAY,I,OVERHEAD,ZIEN
- ;
- S KMPDU(KMPDIEN,"STOP")=$$STATS^%ZOSVKR
- F I=1:1:6 D
- .; check for negative numbers
- .S $P(KMPDU(KMPDIEN,"START"),U,I)=$$NUMBER($P(KMPDU(KMPDIEN,"START"),U,I))
- .S $P(KMPDU(KMPDIEN,"STOP"),U,I)=$$NUMBER($P(KMPDU(KMPDIEN,"STOP"),U,I))
- .; calculate difference
- .S $P(KMPDU(KMPDIEN,"DIFF"),U,I)=$P(KMPDU(KMPDIEN,"STOP"),U,I)-$P(KMPDU(KMPDIEN,"START"),U,I)
- .; check 'difference' for negative number
- .S $P(KMPDU(KMPDIEN,"DIFF"),U,I)=$$NUMBER($P(KMPDU(KMPDIEN,"DIFF"),U,I))
- ;
- ; get overhead data.
- S OVERHEAD=$$GETROVHD
- ; subtract overhead data from "DIFF".
- F I=1:1:6 D
- .S $P(KMPDU(KMPDIEN,"DIFF"),U,I)=$P(KMPDU(KMPDIEN,"DIFF"),U,I)-$P(OVERHEAD,U,I)
- ;
- ; file results
- ; elements.
- F I=1:1:6 S ARRAY((I+3)*.01)=$P(KMPDU(KMPDIEN,"DIFF"),U,I)
- ; file data
- D EDIT^KMPDUTL8(KMPDIEN,"ARRAY")
- ;
- K KMPDU(KMPDIEN)
- ;
- Q
- ;
- CONVERT(KMPDTEXT) ;-- extrinsic function - convert disallowed character(s)
- ;-----------------------------------------------------------------------
- ; KMPDTEXT.. Text to convert.
- ; '^' will be converted to '~'
- ;-----------------------------------------------------------------------
- ;
- S KMPDTEXT=$TR(KMPDTEXT,"^","~")
- Q $E(KMPDTEXT,1,30)
- ;
- GETROVHD() ;-- extrinsic - get routine overhead stats.
- ;-----------------------------------------------------------------------
- ; Return: overhead data in 9 up-arrow (^) pieces:
- ; piece 1 - CPU Time
- ; piece 2 - DIO References
- ; piece 3 - BIO References
- ; piece 4 - Page Faults
- ; piece 5 - M Commands
- ; piece 6 - GLO References
- ; piece 7 - $H Day
- ; piece 8 - $H Seconds
- ; piece 9 - ASCII Date/Time
- ;-----------------------------------------------------------------------
- ;
- D:$G(^XTMP("KMPD","ROVHD"))="" ROVHD
- Q $G(^XTMP("KMPD","ROVHD"))
- ;
- ROVHD ;-- calculate overhead for routine stats.
- ;
- ; This sub-routine determines the overhead for elements when running
- ; RSTART^KMPDUTL1 and RSTOP^KMPDUTL1. The overhead numbers are stored
- ; in ^XTMP("KMPD","ROHD"), and are subtracted from the final numbers
- ; to get as true a picture as possible of the actual elements for the
- ; calling routine.
- ;
- N DIFF,I,START,STOP
- S DIFF=""
- S START=$$STATS^%ZOSVKR
- S STOP=$$STATS^%ZOSVKR
- F I=1:1:6 D
- .S $P(DIFF,U,I)=$P(STOP,U,I)-$P(START,U,I)
- ; m commands.
- S $P(DIFF,U,5)=$P(DIFF,U,5)+8
- ; glo references.
- S $P(DIFF,U,6)=$P(DIFF,U,6)+2
- S ^XTMP("KMPD",0)=$$FMADD^XLFDT($$DT^XLFDT,300)
- S ^XTMP("KMPD","ROVHD")=DIFF
- ;
- Q
- ;
- NUMBER(KMPDNUM) ;-- extrinsic function - check for negative numbers
- ;-----------------------------------------------------------------------
- ; KMPDNUM... Number to be checked
- ;
- ; Return: non-negative number
- ;
- ; Because certain data elements (such as m commands and global
- ; references) can grow to such large numbers, these numbers must be
- ; checked. If they have become negative (the register flips) they
- ; can be turned into positive numbers with
- ;-----------------------------------------------------------------------
- ;
- S KMPDNUM=$G(KMPDNUM)
- Q:KMPDNUM="" KMPDNUM
- Q:KMPDNUM'<0 KMPDNUM
- Q KMPDNUM+(2**32)
- ;
- TRANSTO(KMPDIEN,KMPDAPP,KMPDRES) ;-- return 'transmit to' for data transmission
- ;-----------------------------------------------------------------------
- ; KMPDIEN.... Ien for file #8973 (CP PARAMETERS)
- ; KMPDAPP.... Application:
- ; 1 = sagg
- ; 2 = rum
- ; 3 = hl7
- ; 4 = timing
- ; 5 = vista monitor
- ; KMPDRES().. Results array in format:
- ; KMPDRES(ExternalFormat)=IEN
- ; KMPDRES(... )=IEN
- ;-----------------------------------------------------------------------
- ;
- K KMPDRES
- Q:'$G(KMPDIEN)
- Q:'$D(^KMPD(8973,KMPDIEN,0))
- Q:'$G(KMPDAPP)
- Q:KMPDAPP<1!(KMPDAPP>5)
- ;
- N DATA,I,NODE
- ;
- S NODE=21+(KMPDAPP*.1),I=0
- F S I=$O(^KMPD(8973,KMPDIEN,NODE,I)) Q:'I D
- .Q:'$D(^KMPD(8973,KMPDIEN,NODE,I,0)) S DATA=^(0)
- .S KMPDRES(DATA)=I
- ;
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HKMPDUTL7 5090 printed Feb 18, 2025@23:07:46 Page 2
- KMPDUTL7 ;OAK/RAK - CM Tools Utility ;2/17/04 10:52
- +1 ;;3.0;KMPD;;Jan 22, 2009;Build 42
- +2 ;
- RSTART(KMPDIEN) ;-- start routine statistics
- +1 ;-----------------------------------------------------------------------
- +2 ; KMPDIEN.... Ien for file #8972.1 (CM CODE EVALUATOR).
- +3 ;-----------------------------------------------------------------------
- +4 if '$GET(KMPDIEN)
- QUIT
- +5 if '$DATA(^KMPD(8972.1,+KMPDIEN,0))#5
- QUIT
- +6 ; quit if not 'active'
- +7 if '$PIECE($GET(^KMPD(8972.1,+KMPDIEN,0)),U,11)
- QUIT
- +8 KILL KMPDU(KMPDIEN)
- +9 SET KMPDU(KMPDIEN,"START")=$$STATS^%ZOSVKR
- +10 QUIT
- +11 ;
- RSTOP(KMPDIEN) ;-- stop routine statistics
- +1 ;-----------------------------------------------------------------------
- +2 ; KMPDIEN.... Ien for file #8972.1 (CM CODE EVALUATOR).
- +3 ;-----------------------------------------------------------------------
- +4 if '$GET(KMPDIEN)
- QUIT
- +5 if '$DATA(^KMPD(8972.1,+KMPDIEN,0))#5
- QUIT
- +6 ; quit if no 'start' subscript
- +7 if '$DATA(KMPDU(KMPDIEN,"START"))
- QUIT
- +8 ; quit if not 'active'
- +9 if '$PIECE($GET(^KMPD(8972.1,+KMPDIEN,0)),U,11)
- QUIT
- +10 ;
- +11 NEW ARRAY,I,OVERHEAD,ZIEN
- +12 ;
- +13 SET KMPDU(KMPDIEN,"STOP")=$$STATS^%ZOSVKR
- +14 FOR I=1:1:6
- Begin DoDot:1
- +15 ; check for negative numbers
- +16 SET $PIECE(KMPDU(KMPDIEN,"START"),U,I)=$$NUMBER($PIECE(KMPDU(KMPDIEN,"START"),U,I))
- +17 SET $PIECE(KMPDU(KMPDIEN,"STOP"),U,I)=$$NUMBER($PIECE(KMPDU(KMPDIEN,"STOP"),U,I))
- +18 ; calculate difference
- +19 SET $PIECE(KMPDU(KMPDIEN,"DIFF"),U,I)=$PIECE(KMPDU(KMPDIEN,"STOP"),U,I)-$PIECE(KMPDU(KMPDIEN,"START"),U,I)
- +20 ; check 'difference' for negative number
- +21 SET $PIECE(KMPDU(KMPDIEN,"DIFF"),U,I)=$$NUMBER($PIECE(KMPDU(KMPDIEN,"DIFF"),U,I))
- End DoDot:1
- +22 ;
- +23 ; get overhead data.
- +24 SET OVERHEAD=$$GETROVHD
- +25 ; subtract overhead data from "DIFF".
- +26 FOR I=1:1:6
- Begin DoDot:1
- +27 SET $PIECE(KMPDU(KMPDIEN,"DIFF"),U,I)=$PIECE(KMPDU(KMPDIEN,"DIFF"),U,I)-$PIECE(OVERHEAD,U,I)
- End DoDot:1
- +28 ;
- +29 ; file results
- +30 ; elements.
- +31 FOR I=1:1:6
- SET ARRAY((I+3)*.01)=$PIECE(KMPDU(KMPDIEN,"DIFF"),U,I)
- +32 ; file data
- +33 DO EDIT^KMPDUTL8(KMPDIEN,"ARRAY")
- +34 ;
- +35 KILL KMPDU(KMPDIEN)
- +36 ;
- +37 QUIT
- +38 ;
- CONVERT(KMPDTEXT) ;-- extrinsic function - convert disallowed character(s)
- +1 ;-----------------------------------------------------------------------
- +2 ; KMPDTEXT.. Text to convert.
- +3 ; '^' will be converted to '~'
- +4 ;-----------------------------------------------------------------------
- +5 ;
- +6 SET KMPDTEXT=$TRANSLATE(KMPDTEXT,"^","~")
- +7 QUIT $EXTRACT(KMPDTEXT,1,30)
- +8 ;
- GETROVHD() ;-- extrinsic - get routine overhead stats.
- +1 ;-----------------------------------------------------------------------
- +2 ; Return: overhead data in 9 up-arrow (^) pieces:
- +3 ; piece 1 - CPU Time
- +4 ; piece 2 - DIO References
- +5 ; piece 3 - BIO References
- +6 ; piece 4 - Page Faults
- +7 ; piece 5 - M Commands
- +8 ; piece 6 - GLO References
- +9 ; piece 7 - $H Day
- +10 ; piece 8 - $H Seconds
- +11 ; piece 9 - ASCII Date/Time
- +12 ;-----------------------------------------------------------------------
- +13 ;
- +14 if $GET(^XTMP("KMPD","ROVHD"))=""
- DO ROVHD
- +15 QUIT $GET(^XTMP("KMPD","ROVHD"))
- +16 ;
- ROVHD ;-- calculate overhead for routine stats.
- +1 ;
- +2 ; This sub-routine determines the overhead for elements when running
- +3 ; RSTART^KMPDUTL1 and RSTOP^KMPDUTL1. The overhead numbers are stored
- +4 ; in ^XTMP("KMPD","ROHD"), and are subtracted from the final numbers
- +5 ; to get as true a picture as possible of the actual elements for the
- +6 ; calling routine.
- +7 ;
- +8 NEW DIFF,I,START,STOP
- +9 SET DIFF=""
- +10 SET START=$$STATS^%ZOSVKR
- +11 SET STOP=$$STATS^%ZOSVKR
- +12 FOR I=1:1:6
- Begin DoDot:1
- +13 SET $PIECE(DIFF,U,I)=$PIECE(STOP,U,I)-$PIECE(START,U,I)
- End DoDot:1
- +14 ; m commands.
- +15 SET $PIECE(DIFF,U,5)=$PIECE(DIFF,U,5)+8
- +16 ; glo references.
- +17 SET $PIECE(DIFF,U,6)=$PIECE(DIFF,U,6)+2
- +18 SET ^XTMP("KMPD",0)=$$FMADD^XLFDT($$DT^XLFDT,300)
- +19 SET ^XTMP("KMPD","ROVHD")=DIFF
- +20 ;
- +21 QUIT
- +22 ;
- NUMBER(KMPDNUM) ;-- extrinsic function - check for negative numbers
- +1 ;-----------------------------------------------------------------------
- +2 ; KMPDNUM... Number to be checked
- +3 ;
- +4 ; Return: non-negative number
- +5 ;
- +6 ; Because certain data elements (such as m commands and global
- +7 ; references) can grow to such large numbers, these numbers must be
- +8 ; checked. If they have become negative (the register flips) they
- +9 ; can be turned into positive numbers with
- +10 ;-----------------------------------------------------------------------
- +11 ;
- +12 SET KMPDNUM=$GET(KMPDNUM)
- +13 if KMPDNUM=""
- QUIT KMPDNUM
- +14 if KMPDNUM'<0
- QUIT KMPDNUM
- +15 QUIT KMPDNUM+(2**32)
- +16 ;
- TRANSTO(KMPDIEN,KMPDAPP,KMPDRES) ;-- return 'transmit to' for data transmission
- +1 ;-----------------------------------------------------------------------
- +2 ; KMPDIEN.... Ien for file #8973 (CP PARAMETERS)
- +3 ; KMPDAPP.... Application:
- +4 ; 1 = sagg
- +5 ; 2 = rum
- +6 ; 3 = hl7
- +7 ; 4 = timing
- +8 ; 5 = vista monitor
- +9 ; KMPDRES().. Results array in format:
- +10 ; KMPDRES(ExternalFormat)=IEN
- +11 ; KMPDRES(... )=IEN
- +12 ;-----------------------------------------------------------------------
- +13 ;
- +14 KILL KMPDRES
- +15 if '$GET(KMPDIEN)
- QUIT
- +16 if '$DATA(^KMPD(8973,KMPDIEN,0))
- QUIT
- +17 if '$GET(KMPDAPP)
- QUIT
- +18 if KMPDAPP<1!(KMPDAPP>5)
- QUIT
- +19 ;
- +20 NEW DATA,I,NODE
- +21 ;
- +22 SET NODE=21+(KMPDAPP*.1)
- SET I=0
- +23 FOR
- SET I=$ORDER(^KMPD(8973,KMPDIEN,NODE,I))
- if 'I
- QUIT
- Begin DoDot:1
- +24 if '$DATA(^KMPD(8973,KMPDIEN,NODE,I,0))
- QUIT
- SET DATA=^(0)
- +25 SET KMPDRES(DATA)=I
- End DoDot:1
- +26 ;
- +27 QUIT