OpenSDN source code
Trace< TraceEntryT > Class Template Reference

#include <trace.h>

Collaboration diagram for Trace< TraceEntryT >:

Public Types

using TraceBufMap = typename TraceBuffer< TraceEntryT >::TraceBufMap
 A link to the trace buffers table type. More...
 

Public Member Functions

void TraceOn ()
 Enables tracing for the table. More...
 
void TraceOff ()
 Disables tracing for the table. More...
 
bool IsTraceOn ()
 Determines whether tracing is enabled for the table. More...
 
boost::shared_ptr< TraceBuffer< TraceEntryT > > TraceBufGet (const std::string &buf_name)
 
boost::shared_ptr< TraceBuffer< TraceEntryT > > TraceBufAdd (const std::string &buf_name, size_t size, bool trace_enable)
 
void TraceBufListGet (std::vector< std::string > &trace_buf_list)
 Requests the list of trace buffers names from the table. More...
 
size_t TraceBufCapacityGet (const std::string &buf_name)
 Returns the capacity of the trace buffer with the given name. More...
 
boost::shared_ptr< TraceBuffer< TraceEntryT > > TraceBufCapacityReset (const std::string &buf_name, size_t size)
 

Static Public Member Functions

static TraceGetInstance ()
 Returns a pointer to the trace buffers table instance. More...
 

Private Member Functions

 Trace ()
 Forbids the default ctor. More...
 
 ~Trace ()
 Destroys the table. More...
 
 DISALLOW_COPY_AND_ASSIGN (Trace)
 

Private Attributes

tbb::atomic< bool > trace_enable_
 Determines if the tracing is enabled for the table. More...
 
TraceBufMap trace_buf_map_
 Stores the table of trace buffers. More...
 
tbb::mutex mutex_
 A mutex to protect the table from data races. More...
 

Static Private Attributes

static Tracetrace_ = NULL
 A pointer to the table (singleton) used in this program. More...
 

Detailed Description

template<typename TraceEntryT>
class Trace< TraceEntryT >

The table for managing trace buffers using a map between their names and instances. The table is a singletone, the memory for its records is managed by the user (only weak pointers are stored in the table).

Definition at line 286 of file trace.h.

Member Typedef Documentation

◆ TraceBufMap

template<typename TraceEntryT >
using Trace< TraceEntryT >::TraceBufMap = typename TraceBuffer<TraceEntryT>::TraceBufMap

A link to the trace buffers table type.

Definition at line 290 of file trace.h.

Constructor & Destructor Documentation

◆ Trace()

template<typename TraceEntryT >
Trace< TraceEntryT >::Trace ( )
inlineprivate

Forbids the default ctor.

Definition at line 388 of file trace.h.

◆ ~Trace()

template<typename TraceEntryT >
Trace< TraceEntryT >::~Trace ( )
inlineprivate

Destroys the table.

Definition at line 393 of file trace.h.

Member Function Documentation

◆ DISALLOW_COPY_AND_ASSIGN()

template<typename TraceEntryT >
Trace< TraceEntryT >::DISALLOW_COPY_AND_ASSIGN ( Trace< TraceEntryT >  )
private

◆ GetInstance()

template<typename TraceEntryT >
static Trace* Trace< TraceEntryT >::GetInstance ( )
inlinestatic

Returns a pointer to the trace buffers table instance.

Definition at line 293 of file trace.h.

Here is the call graph for this function:

◆ IsTraceOn()

template<typename TraceEntryT >
bool Trace< TraceEntryT >::IsTraceOn ( )
inline

Determines whether tracing is enabled for the table.

Definition at line 311 of file trace.h.

◆ TraceBufAdd()

template<typename TraceEntryT >
boost::shared_ptr<TraceBuffer<TraceEntryT> > Trace< TraceEntryT >::TraceBufAdd ( const std::string &  buf_name,
size_t  size,
bool  trace_enable 
)
inline

Adds a trace buffer with the given name and size and returns a reference to it. Returns a shared_ptr of the trace buffer for the memory management.

Definition at line 329 of file trace.h.

◆ TraceBufCapacityGet()

template<typename TraceEntryT >
size_t Trace< TraceEntryT >::TraceBufCapacityGet ( const std::string &  buf_name)
inline

Returns the capacity of the trace buffer with the given name.

Definition at line 357 of file trace.h.

◆ TraceBufCapacityReset()

template<typename TraceEntryT >
boost::shared_ptr<TraceBuffer<TraceEntryT> > Trace< TraceEntryT >::TraceBufCapacityReset ( const std::string &  buf_name,
size_t  size 
)
inline

Sets a new size of the trace buffer with the given name. If the trace buffer with the specified with given name is not found, then an empty trace buffer is returned.

Definition at line 372 of file trace.h.

◆ TraceBufGet()

template<typename TraceEntryT >
boost::shared_ptr<TraceBuffer<TraceEntryT> > Trace< TraceEntryT >::TraceBufGet ( const std::string &  buf_name)
inline

Returns a pointer to the trace buffer associated with the given name. If there is no such a trace buffer, then an empty one is returned.

Definition at line 317 of file trace.h.

◆ TraceBufListGet()

template<typename TraceEntryT >
void Trace< TraceEntryT >::TraceBufListGet ( std::vector< std::string > &  trace_buf_list)
inline

Requests the list of trace buffers names from the table.

Definition at line 348 of file trace.h.

◆ TraceOff()

template<typename TraceEntryT >
void Trace< TraceEntryT >::TraceOff ( )
inline

Disables tracing for the table.

Definition at line 306 of file trace.h.

◆ TraceOn()

template<typename TraceEntryT >
void Trace< TraceEntryT >::TraceOn ( )
inline

Enables tracing for the table.

Definition at line 301 of file trace.h.

Member Data Documentation

◆ mutex_

template<typename TraceEntryT >
tbb::mutex Trace< TraceEntryT >::mutex_
private

A mutex to protect the table from data races.

Definition at line 408 of file trace.h.

◆ trace_

TraceSandeshType * TraceSandeshType::trace_ = NULL
staticprivate

A pointer to the table (singleton) used in this program.

Definition at line 399 of file trace.h.

◆ trace_buf_map_

template<typename TraceEntryT >
TraceBufMap Trace< TraceEntryT >::trace_buf_map_
private

Stores the table of trace buffers.

Definition at line 405 of file trace.h.

◆ trace_enable_

template<typename TraceEntryT >
tbb::atomic<bool> Trace< TraceEntryT >::trace_enable_
private

Determines if the tracing is enabled for the table.

Definition at line 402 of file trace.h.


The documentation for this class was generated from the following files: