Add ability to time each test by making verbose = 2

This commit is contained in:
Sam Habiel 2015-12-30 15:11:59 -08:00
parent 23836bfb47
commit 100045907e
1 changed files with 431 additions and 417 deletions

View File

@ -100,8 +100,19 @@ EN1(%utROU,%utLIST) ;
. . S %ut("NAME")=%utETRY(%utI,"NAME")
. . S %ut("ENT")=%utETRY(%utI)_"^"_%utROU(%ut("CURR"))
. . I %utVERB,'$D(%utGUI) D VERBOSE1(.%utETRY,%utI) ; Say what we executed.
. . ;
. . I %utVERB=2 N %utStart D ; User Time Start
. . . I +$SY=0 S %utStart=$P($SYSTEM.Process.GetCPUTime(),",",2)
. . . I +$SY=47 S %utStart=$ZGETJPI("","CPUTIM")*10
. . ;
. . ; Run the test!
. . D @%ut("ENT")
. . ;
. . I %utVERB=2 N %utEnd,%utElapsed D ; User Time End
. . . I +$SY=0 S %utEnd=$P($SYSTEM.Process.GetCPUTime(),",",2)
. . . I +$SY=47 S %utEnd=$ZGETJPI("","CPUTIM")*10
. . . S %utElapsed=%utEnd-%utStart_"ms"
. . ;
. . ; Run Teardown Code (only if present)
. . S %ut("ENT")=$G(%ut("TEARDOWN"))
. . S %ut("NAME")="Teardown Code"
@ -111,8 +122,8 @@ EN1(%utROU,%utLIST) ;
. . ; Only print out the success message [OK] If our error number remains
. . ; the same as when we started the loop.
. . I %utVERB,'$D(%utGUI) D
. . . I %ut("ENUM")=(%ut("ERRN")+%ut("FAIL")) D VERBOSE(.%utETRY,%utI,1) I 1
. . . E D VERBOSE(.%utETRY,%utI,0)
. . . I %ut("ENUM")=(%ut("ERRN")+%ut("FAIL")) D VERBOSE(.%utETRY,1,%utVERB,$G(%utElapsed)) I 1
. . . E D VERBOSE(.%utETRY,0,%utVERB,$G(%utElapsed))
. . . Q
. . Q
. ; keep a %utCNT of number of entry points executed across all routines
@ -127,13 +138,16 @@ EN1(%utROU,%utLIST) ;
D RESETIO^%ut1
Q
; -- end EN1
VERBOSE(%utETRY,%utI,SUCCESS) ; Say whether we succeeded or failed.
VERBOSE(%utETRY,SUCCESS,%utVERB,%utElapsed) ; Say whether we succeeded or failed.
; ZEXCEPT: %ut - NEWED IN EN
D SETIO^%ut1
N I F I=$X+3:1:73 W "-"
W ?73
N RM S RM=73 ; Right Margin
I %utVERB=2,$G(%utElapsed)]"" S RM=RM-$L(%utElapsed)-1
N I F I=$X+3:1:RM W "-"
W ?RM
I $G(SUCCESS) W "[OK]"
E W "[FAIL]"
I %utVERB=2,$G(%utElapsed)]"" W " ",%utElapsed
D RESETIO^%ut1
Q
;