Skip to content

Log-Timer / ElliottTimer.Ini Support

Release Date: 02/21/2018

Description

From time to time, a systems-layer developer may need to embed some low-footprint debugging statements in production code that can be activated with a configuration file at a client's site.  There is an RCM (Reusable Code Manager) macro named LOG-TIMER that provides that functionality.  Its features include the following:
  • Ability to produce a trace line with a variable message in the log file whenever it is encountered.
  • Include the elapsed time between LOG-TIMER statements and the running elapsed time.
  • When activated, produce a separate trace file for each program that contains the LOG-TIMER statement...
  • ...Or, produce a single, named trace file for LOG-TIMER statements in multiple programs with matching [NAME timer ] phrases.
  • Write the logs to the user's %TEMP% file to prevent collision of traces among users and to minimize the performance impact of the logging.
  • When not activated, has almost no performance impact on the program,
Typical uses include these activities:
  • Helps pinpoint performance bottlenecks.
  • Produce a trace to help pinpoint a failure in the code (e.g., 114-error).
Adding LOG-TIMER Statements to COBOL Programs

Syntax:

LOG-TIMER
    [ NAME timer ]
    [ USER logtimeruser ]
    { msg | RESET }

Description:

This macro logs the elapsed time (since the last RESET message) and %msg% to a file in the Windows %Temp% directory. By default, the filename is <progname>.Log.  Very little code is executed when the timer is not activated, so one can add Log-Timer macro statements to programs without concern for the overall overhead of the application.

The .Ini filename is ElliottTimer.Ini, but it can be overridden by adding an additional RCM statement before all LogTimer macro statements in the program:
        
              Set-RCM-Variable LogTimerIni = <filename>

[ NAME timer ], if specified, changes the log filename from <progname>.Log to %Timer%.Log.  %Timer% is a literal without quotes.  This optional phrase typically is used to log timing events across programs.

[ USER logtimeruser ], if supplied, will only log when the entry in the .Ini file is set to the same value as %logtimeruser%.  This allows selective activation of the timing and logging.  

For example, one must add the following phrase in each of a program's LOG-TIMER macro statements in order to enable activation for just a specific Elliott user:

         USER SMA-USER-NAME

Code Example

JG1802   Log-Timer User SMA-User-Name "Start"
...
JG1802   Log-Timer User SMA-User-Name " before WS-Mail-Desc..."
...
JG1802   Log-Timer User SMA-User-Name " before Save-Fltr-Rows..."
...
  JG1802   Log-Timer User SMA-User-Name " before Save-Fltr-Rows..."  

Example Output


NWSMMSEM: 2/21/2018 2:32pm Timer = NWSMMSEM
  Incr. Total Program     Log Message                                   ------- ------- ------------ -----------                                     .00 14.06 NWSMMSEM   Start                                              .01 14.07 NWSMMSEM     before WS-Mail-Desc...                           .00 14.07 NWSMMSEM     before Save-Fltr-Rows...                         .00 14.07 NWSMMSEM     before WS-Email-Fields...  

Configuration of ElliottTimer.Ini

Logging only takes place when the corresponding entry in ElliottTimer.Ini in the current directory is set to "Yes," "All" or a value matching %logtimeruser%, if that phrase is specified in the LOG-TIMER macro statement:  For example:

          [Log-Timer]
      ARCUSMNT=All
      STARTUP=Jim

In the above example, when ARCUSMNT is executing, any LOG-TIMER statements will produce output in %TEMP%\ARCUSMNT.Log for each user.  When LOG-TIMER NAME STARTUP statements are executing, only Elliott user "JIM" will produce output in his %TEMP%\STARTUP.Log.

All other LOG-TIMER statements in Elliott will be ignored.

We do not publish a list of LOG-TIMER possibilities in the Elliott programs, because they should be enabled on an as-needed basis with the coordination of an Elliott support specialist.

Modified programs: None
JEG

Feedback and Knowledge Base