LT API for Logging Timer Messages
LT API
Release Date: 4/28/2023
Versions: V8.5 and Higher
Purpose
This API allows the developer to log a timing message in application code. It can be helpful when trying to determine where there may be time-consuming processing bottlenecks.
Features of this API include the following:
- Multiple programs can use the same timer log file by specifying the same timer name in Screen-Alpha-Field.
- The first LT API for a specified timer log file within a process will delete the timer log file if it already exists.
- Multiple log timer files can be produced in the same process at the same time by using different timer names.
- LT APIs can be left in production code without causing any significant performance costs as long as the timer is not turned on in the configuration file.
- The timestamp column in each line of output is formatted so that it can be used to look for a precise spot in FileMonitor output. FileMonitor is a tool from Infragistics that tracks every access to registry and disk files in a process.
API Details
Screen-Parameters:
LT To log a timing message to a specified log file
LT To log a timing message to a specified log file
Screen-Alpha-Field:
timer name The base portion of the log filename
Screen-Literal:
message The text that will be logged along with the timing information
If message = "RESET," the elapsed time will be set back to zero
Example:
MOVE "LT" TO SCREEN-PARAMETERS.
MOVE "CRDTCARD" TO SCREEN-ALPHA-FIELD.
MOVE "Send credit card request to the credit card processor"
PERFORM SCREEN-ROUTINE.
...
MOVE "LT" TO SCREEN-PARAMETERS.
MOVE "CRDTCARD" TO SCREEN-ALPHA-FIELD.
MOVE "Received response from the credit card processor"
PERFORM SCREEN-ROUTINE.
ElliottTimer.INI
Just adding the LT API to the program is not enough to cause logging to happen. You must also create an entry, matching the contents of Screen-Alpha-Field, to enable logging for the timer:
[Log-Timer]
CRDTCARD=Yes
The Log File
The log file, CRDTCARD.LOG in the above example, is created in the %temp% directory. The output will look similar to this:NWSMRGP : 4/28/2023 7:36am Timer = NWSMRGP
Incr. Total TimeStamp Program Log Message
------- ----- ----------- --------- -----------
.00 .00 07:36:43.31 ...Timer Reset
.04 .05 07:36:43.36 NWSMRGP: Before Init-Panels2...
.71 .76 07:36:44.07 NWSMRGP: Before Load-Fonts...
.30 1.06 07:36:44.37 NWSMRGP: Before Verify-Window-Active...
.01 1.07 07:36:44.38 NWSMRGP: Before Start-Up-Step-1
.33 1.40 07:36:44.71 NWSMRGP: After Start-NSIFH-Runtime
.00 1.40 07:36:44.71 NWSMRGP: After Synchronize-For-RunLocal
.20 1.60 07:36:44.91 NWSMRGP: After Check-PSQL2000-Settings
.02 1.62 07:36:44.93 NWSMRGP: After NWSTRTFH
.19 1.81 07:36:45.12 NWSMRGP: After Start-Up-Step-1
JEG
NWSMSCRN.CBL