CnC
Static Public Member Functions | List of all members
debug Struct Reference

Debugging interface providing tracing and timing capabilities. More...

Static Public Member Functions

static void CNC_API set_num_threads (int n)
 sets the number of threads used by the application More...
 
template<typename Tag , typename Tuner >
static void trace (tag_collection< Tag, Tuner > &tc, int level=1)
 enable tracing of a given tag collection at a given level More...
 
template<typename Tag , typename Item , typename HC >
static void trace (item_collection< Tag, Item, HC > &ic, int level=1)
 enable tracing of a given item collection at a given level More...
 
template<typename UserStep , typename Tuner >
static void trace (step_collection< UserStep, Tuner > &sc, int level=1)
 enable tracing of a given step-collection at a given level (off=0) More...
 
static void CNC_API trace (::CnC::graph &g, int level=1)
 enable tracing of graph internals (not including its I/O collections) More...
 
template<class Derived >
static void trace_all (::CnC::context< Derived > &c, int level=1)
 enable tracing of everything in given context (off=0) More...
 
static void init_timer (bool cycle=false)
 initalize timer More...
 
static void finalize_timer (const char *name)
 save collected time log to a specified file More...
 
template<typename UserStep , typename Tuner >
static void time (step_collection< UserStep, Tuner > &sc)
 enable timing of a given step More...
 
template<class Derived >
static void collect_scheduler_statistics (::CnC::context< Derived > &c)
 enable collection scheduler statistics per context More...
 

Detailed Description

Debugging interface providing tracing and timing capabilities.

#include <cnc/debug.h>

For a meaningful tracing the runtime requires a function cnc_format for every non-standard item and tag type. The expected signature is:

std::ostream & cnc_format( std::ostream & os, const your_type & p )

Make sure it is defined in the corresponding namespace.

Definition at line 56 of file debug.h.

Member Function Documentation

◆ collect_scheduler_statistics()

static void collect_scheduler_statistics ( ::CnC::context< Derived > &  c)
inlinestatic

enable collection scheduler statistics per context

Statistics will be print upon destructino of a context.

Parameters
cthe context to be examined

Definition at line 135 of file debug.h.

136  { c.init_scheduler_statistics(); }

◆ finalize_timer()

static void finalize_timer ( const char *  name)
inlinestatic

save collected time log to a specified file

Parameters
namethe file to write the time log, pass "-" for printing to stdout

Definition at line 119 of file debug.h.

120  { Internal::chronometer::save_log( name ? name : "-" ); }

◆ init_timer()

static void init_timer ( bool  cycle = false)
inlinestatic

initalize timer

Parameters
cycleif true, use cycle counter only Cycle counters might overflow: TSC results are incorrect if the measured time-interval is larger than a full turn-around.

Definition at line 114 of file debug.h.

115  { Internal::chronometer::init( cycle ); }

◆ set_num_threads()

static void CNC_API set_num_threads ( int  n)
static

sets the number of threads used by the application

Overwrites environment variable CNC_NUM_THREADS. To be effective, it must be called prior to context creation.

◆ time()

static void time ( step_collection< UserStep, Tuner > &  sc)
inlinestatic

enable timing of a given step

To be used in a safe environment only (no steps in flight)

Parameters
scthe step-collection to be timed

Definition at line 127 of file debug.h.

128  { sc.set_timing(); }

◆ trace() [1/4]

static void trace ( tag_collection< Tag, Tuner > &  tc,
int  level = 1 
)
inlinestatic

enable tracing of a given tag collection at a given level

To be used in a safe environment only (no steps in flight)

Parameters
tcthe tag collection to be traced
leveltrace level

Definition at line 69 of file debug.h.

70  { tc.m_tagCollection.set_tracing( level ); }

◆ trace() [2/4]

static void trace ( item_collection< Tag, Item, HC > &  ic,
int  level = 1 
)
inlinestatic

enable tracing of a given item collection at a given level

To be used in a safe environment only (no steps in flight).

Parameters
icthe item collection to be traced
leveltrace level

Definition at line 78 of file debug.h.

79  { ic.m_itemCollection.set_tracing( level ); }

◆ trace() [3/4]

static void trace ( step_collection< UserStep, Tuner > &  sc,
int  level = 1 
)
inlinestatic

enable tracing of a given step-collection at a given level (off=0)

To be used in a safe environment only (no steps in flight)

Parameters
scthe step-collection to be traced
leveltrace level

Definition at line 87 of file debug.h.

88  {
89  sc.set_tracing( level );
90  CNC_ASSERT( sc.trace_level() == level );
91  }

◆ trace() [4/4]

static void CNC_API trace ( ::CnC::graph g,
int  level = 1 
)
static

enable tracing of graph internals (not including its I/O collections)

To be used in a safe environment only (no steps in flight) names of collections are unavailable unless tracing them was enabled explicitly.

Parameters
gthe graph to be traced
leveltrace level

◆ trace_all()

static void trace_all ( ::CnC::context< Derived > &  c,
int  level = 1 
)
inlinestatic

enable tracing of everything in given context (off=0)

To be used in a safe environment only (no steps in flight)

Parameters
cthe context to be traced
leveltrace level

Definition at line 107 of file debug.h.

108  { c.set_tracing( level ); }

The documentation for this struct was generated from the following file: