cobctf_tracer_notify

Installs or uninstalls a tracer configuration callback function.

Syntax:
cobrtncode_t cobctf_tracer_notify(cobuns32_t    install_function,
                                  NOTIF_INSTALL *notif_install)
Parameters:
install_function The operation to perform:
0 Install a callback.
1 Uninstall a callback.
trace_event Trace event structure:
version Structure version. Must be 0.
handle Handle of component tracer (returned from a call to CBL_CTF_TRACER_GET) for which a callback is to be installed or uninstalled.
callback Callback function to install (if install-function is 0) or uninstall (if install-function is 1).
cobrtncode_t One of:
  • CTF_RET_FAILURE
  • CTF_RET_INVALID_TRACE_HANDLE
  • CTF_RET_NOT_ENOUGH_MEMORY
  • CTF_RET_SUCCESS
Comments:

A tracer configuration callback function is installed by a component to allow it to be notified when any configuration change to the associated tracer occurs, such as a threshold level change, or property value change.

Example:

To acquire a tracer handle to trace "mycomp" component events, and install a callback to handle threshold level and property change notifications:

#include "mfctf.h"

some_func()
{
    const cobuns8_t *component_id  = "mycomp";
    NOTIF_INSTALL   notif_install;
    cobuns32_t      tracer_handle;
    ...
    /*
    ** Acquire tracer handle
    */
    CBL_CTF_TRACER_GET(CTF_FLAG_COMP_NAME_NULL_TERM,
                       component_id, 
                       (cbl_x4_comp5_t *)&tracer_handle); 

    ...

      /*
      ** Install callback function
      */
      memset(&notif_install, 0, sizeof(notif_install));

      notif_install.handle = tracer_handle;
      notif_install.callback = my_callback;

      cobctf_tracer_notify(0, &notif_install);
     ...
  }
  
  /*
  ** The callback function to handle trace level and property 
  ** changes
  */
  void my_callback(cobuns32_t tracer_handle,
                   cobuns32_t notif_type,
                   void       *notif_info)
  {
      switch(notif_type)
      {
          case TRACER_NOTIF_TYPE_PROP_CHANGE:
              break;

          case TRACER_NOTIF_TYPE_LEVEL_CHANGE:
              break;      
      }
  }

Related Topics: