IBM Support

How to determine the amount of elapsed time ClearCase spends in trigger logic

Question & Answer


Question

What environment variable can you set to assist in determining if an IBM® Rational® ClearCase® trigger has fired and if so, the elapsed time spent in the trigger logic?

Answer

You can set the CLEARCASE_TRACE_TRIGGERS environment variable before performing the operation that is expected to fire the trigger.

If there is a question about whether or not a trigger is actually fired as expected when performing a specific operation, setting this environment variable can provide that initial validation by indicating when the trigger is firing (example: Firing pre-operation trigger type "SLOW_DOWN_CO").

Refer to the IBM Rational ClearCase Command Reference Manual under the topics of mktrtype and mktrigger for details about creating triggers.


Setting the CLEARCASE_TRACE_TRIGGERS environment as described below causes exactly 2 lines to be printed:
  • The start time of trigger execution
  • The end time of the trigger execution


The main purpose of this environment variable is to time how long one spends in the trigger logic.

For example:

%cleartool  checkout -unr clearping

Checkout comments for "clearping":

.

>>> 04:38:44.048 (cleartool): Firing pre-operation trigger type "SLOW_DOWN_CO"...

>>> 04:38:46.239 (cleartool): ... trigger type "SLOW_DOWN_CO" done.

Checked out "clearping" from version "/main/13".


From the above output, one can deduce that of the overall time that the checkout command took, 2.191 seconds were spent in the trigger logic.


Setting the environment variable CLEARCASE_TRACE_TRIGGERS

UNIX®/Linux® example (for csh shell):

ENABLE:

setenv CLEARCASE_TRACE_TRIGGERS 1

DISABLE:

setenv CLEARCASE_TRACE_TRIGGERS 0


Note: The syntax to set the environment variable will differ depending on the shell in use.



Microsoft® Windows® example:


ENABLE:


set CLEARCASE_TRACE_TRIGGERS=1



DISABLE:


set CLEARCASE_TRACE_TRIGGERS=0


Review the Rational ClearCase Reference Guide on the topic of env_ccase (cleartool man env_ccase) for a complete list of ClearCase variables.

Note: For even more detailed debugging information, modify your trigger scripts to display information as it executes.





Below is a basic example of a post-op checkin trigger on Windows:
  • Here are the details of the trigger type:

    M:\def1\test-vob>cleartool describe -l trtype:ci_trigger
  • trigger type "ci_trigger"

      created 2009-07-14T13:16:38-04:00 by Denise (denise.user@MYHOST-I)

      owner: DOMAIN1\denise

      group: DOMAIN1\user

      all element trigger

      post-operation checkin

      action: -exec \\myhost-I\data\testscript.bat

  • The trace environment variable is set as following:

  • M:\def1\test-vob>set CLEARCASE_TRACE_TRIGGERS=1

  • Perform the checkout operation to fire the trigger

  • M:\def1\test-vob>cleartool checkin -nc zero.txt

    >>> 13:37:26.36261790404838314 (cleartool): Firing post-operation trigger type "ci_trigger"...

    M:\def1\test-vob>creds  1>>\\MYHOST-I\data\log.txt

    >>> 13:37:27.36261790404837549 (cleartool): ... trigger type "ci_trigger" done.

    Checked in "zero.txt" version "\main\8".



[{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Environment Variables","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"2003.06.00;2003.06.16;7.0;7.0.1;7.1","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Environment Variables","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
29 September 2018

UID

swg21126919