Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: KMPDUTL7

KMPDUTL7.m

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