msp_trace.h File Reference

This module provides a fast tracing mechanism where the data threads can write to a per cpu buffer and a periodic on the control sweeps these buffers and dumps the output to a trace file. More...


Enumerations

enum  { MSP_TRACE_BRIEF = 1, MSP_TRACE_DETAIL = 2, MSP_TRACE_EXTENSIVE = 3, MSP_TRACE_VERBOSE = 4 }
 Sample levels to be used by msp_trace API.

Functions

int msp_trace_handle_create (const char *name)
 Create a trace handle to be used by other trace APIs.
int msp_trace_handle_setlevel (int handle, int level)
 Set trace level for the given handle.
int msp_trace_handle_getlevel (int handle)
 Get trace level for the given handle.
void msp_trace (int handle, int level, const char *format,...)
 Fast trace API.
void msp_log (int log_level, const char *format,...)
 Fast log API.


Detailed Description

This module provides a fast tracing mechanism where the data threads can write to a per cpu buffer and a periodic on the control sweeps these buffers and dumps the output to a trace file.

The same backend is used for syslogs and the output is just sent to RE. (syslog, tracing use different buffers and enabling one should not impact the other one).

Assumptions are that this tracing will be controlled and if the per cpu buffers fill up traces/syslogs can be lost.

Trace handles are a generic way to control the level of tracing for subset of traces. This can be controlled from debug cli. Idea is to provide a generic way for trace users to set/clear trace options from debug cli without having to change debug cli.

These APIs can only be used from plugin context.


Function Documentation

void msp_log int  log_level,
const char *  format,
  ...
 

Fast log API.

Parameters:
[in] log_level Level to log at. This is passed as is to syslog on the control.
[in] format printf like format.

void msp_trace int  handle,
int  level,
const char *  format,
  ...
 

Fast trace API.

Parameters:
[in] handle Trace handle.
[in] level Only create the trace if the configured level is greater or equal to this level.
[in] format printf like formar.

int msp_trace_handle_create const char *  name  ) 
 

Create a trace handle to be used by other trace APIs.

Parameters:
[in] name A unique name to represent the handle.
Returns:
Trace handle on success, -1 on failure.

int msp_trace_handle_getlevel int  handle  ) 
 

Get trace level for the given handle.

Parameters:
[in] Trace handle to operate on.
Returns:
Trace level on success, -1 on failure.

int msp_trace_handle_setlevel int  handle,
int  level
 

Set trace level for the given handle.

Parameters:
[in] handle Trace handle to operate on.
[in] level Trace level to be set.
Returns:
MSP_OK on success, -1 on failure.


2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:24:53 2010 for libmsp-svcs by Doxygen 1.4.5