CBL_CTF_TRACER_LEVEL_GET

Returns a tracer's current threshold trace level.

Syntax:
call "CBL_CTF_TRACER_LEVEL_GET" using by value     flags
                                      by reference component-id
                                      by reference trace-level
                                         returning status-code
Parameters:
Using call prototype (see Library Routines - Key) Picture (32-bit systems)
flags cblt-x4-comp5 pic x(4) comp-5
component-id pic x(n) pic x(n)
trace-level cblt-x4-comp5 pic x(4) comp-5
status-code See Library Routines - Key
On Entry:
flags Control flags:
Bit Value Meaning
0-29 Reserved for future use. Must be 0.
30 0 component-id is space-terminated.
1 component-id is null-terminated. This is ignored if bit 31 is unset.
31 0 component-id is a pic x(4) comp-5 tracer handle returned from a call to CBL_CTF_TRACER_GET.
1 component-id is a pic x(n) text string. The termination character for the string is defined by bit 30.
component-id Component identifier. This is either a pic x(4) comp-5 tracer handle (from CBL_CTF_TRACER_GET) if bit 31 of flags is not set, or a pic x(n) text identifier if bit 31 of flags is set.

The default trace level is returned if a NULL or empty string is specified.

On Exit:
trace-level Value indicating the tracer's threshold trace level:
Value Level
0 Debug
1 Info
2 Warn
3 Error
4 Fatal
0xFFFFFFFF Not enabled for tracing
status-code One of:
  • 78-CTF-RET-INVALID-COMPONENT-NAME
  • 78-CTF-RET-INVALID-TRACE-HANDLE
  • 78-CTF-RET-NOT-ENOUGH-MEMORY
  • 78-CTF-RET-SUCCESS
Comments:

You typically call this routine before performing any costly trace data formatting that CBL_CTF_TRACE might involve.

If you have used CBL_CTF_TRACER_NOTIFY to install a callback function to process any changes made to the tracer's configuration, you only need to call CBL_CTF_TRACER_LEVEL_GET during trace initialization and in the callback function when the threshold trace level changes.

When a component needs to check for the current threshold trace level it can check the variable into which CBL_CTF_TRACER_LEVEL_GET has previously returned the threshold value.

Example:

To acquire a tracer handle to trace "mycomp" component events, and then use CBL_CTF_TRACER_LEVEL_GET to determine whether the component is configured to trace information level events before performing the trace operation:

 
copy "cbltypes.cpy".
copy "mfctf.cpy".

78 78-EVENT-TYPE-A      value 1.

01 component-name       pic x(7) value "mycomp".
01 flags                pic x(4) comp-5.
01 trace-event          cblt-trc-event.
01 trace-level          pic x(4) comp-5.
01 tracer-handle        pic x(4) comp-5.
...
call "CBL_CTF_TRACER_GET" using by value 0
                                by reference component-name
                                by reference tracer-handle
...
call "CBL_CTF_TRACER_LEVEL_GET" using by value 0
                                      by reference component-name
                                      by reference trace-level

if 78-CTF-FLAG-LEVEL-INFO >= trace-level
      set up trace-info
      compute flags = 78-CTF-FLAG-LEVEL-INFO

      call “CBL_CTF_TRACE” using by value flags
                                 by reference tracer-handle
                                 by reference trace-event
end-if
...

Related Topics: