Sen API
Sen Libraries
Loading...
Searching...
No Matches
sen::kernel::Tracer Class Referenceabstract

Interface implemented by tracers. You can use it to trace the behavior of your code. Please note that not all tracers support the functions below. More...

#include <tracer.h>

Public Member Functions

 Tracer ()=default
virtual ~Tracer ()=default
auto makeScopedZone (const SourceLocation &location)
 Create a scoped zone. You can use scoped zones to trace the lifetime of a given block (the typical example is a function).
auto makeScopedZone (std::string_view name, const SourceLocation &location)
 Create a scoped zone with a given name.
virtual void frameStart (std::string_view name)=0
 Marks the start of a (named) frame. Needs to be paired with a corresponding call to frameEnd.
virtual void frameEnd (std::string_view name)=0
 Marks the end of a (named) frame. Needs to be paired with a corresponding call to frameStart.
virtual void message (std::string_view name)=0
 Sends a message that will be traced.
virtual void plot (std::string_view name, float64_t value)=0
 Sends a value that will be plotted.
virtual void plot (std::string_view name, int64_t value)=0
 Sends a value that will be plotted.

Protected Member Functions

virtual void zoneStart (std::string_view name, const SourceLocation &location)=0
virtual void zoneEnd ()=0

Detailed Description

Interface implemented by tracers. You can use it to trace the behavior of your code. Please note that not all tracers support the functions below.

Constructor & Destructor Documentation

◆ Tracer()

sen::kernel::Tracer::Tracer ( )
default

◆ ~Tracer()

virtual sen::kernel::Tracer::~Tracer ( )
virtualdefault

Member Function Documentation

◆ makeScopedZone() [1/2]

auto sen::kernel::Tracer::makeScopedZone ( const SourceLocation & location)
inlinenodiscard

Create a scoped zone. You can use scoped zones to trace the lifetime of a given block (the typical example is a function).

Parameters
locationuse the SEN_SL() macro.

example usage:

int myFunc()
{
static constexpr auto sl = SEN_SL();
auto zone = tracer.makeScopedZone(sl);
}
#define SEN_SL()
Convenience macro including the source location info. NOLINTNEXTLINE(cppcoreguidelines-macro-usage).
Definition source_location.h:62

For a less verbose approach, you can use:

int myFunc(Tracer& tracer)
{
SEN_TRACE_ZONE(tracer);
}
#define SEN_TRACE_ZONE(tracer)
Helper macro that creates a static source location and defines a scoped zone.
Definition tracer.h:149

◆ makeScopedZone() [2/2]

auto sen::kernel::Tracer::makeScopedZone ( std::string_view name,
const SourceLocation & location )
inlinenodiscard

Create a scoped zone with a given name.

Parameters
nameshould not change for a given zone during the program execution.
locationuse the SEN_SL macro.

example usage:

void myFunc(Tracer& tracer)
{
static constexpr auto sl = SEN_SL();
auto zone = tracer.makeScopedZone("doing something", sl);
}
auto makeScopedZone(const SourceLocation &location)
Create a scoped zone. You can use scoped zones to trace the lifetime of a given block (the typical ex...
Definition tracer.h:162

For a less verbose approach, you can use:

void myFunc(Tracer& tracer)
{
SEN_TRACE_ZONE_NAMED(tracer, "doing something");
}
#define SEN_TRACE_ZONE_NAMED(tracer, name)
Helper macro that creates a static source location and defines a named scoped zone.
Definition tracer.h:136

◆ frameStart()

virtual void sen::kernel::Tracer::frameStart ( std::string_view name)
pure virtual

Marks the start of a (named) frame. Needs to be paired with a corresponding call to frameEnd.

Parameters
nameshould not change for a given frame mark during the program execution.
Note
Only supported by frame-oriented tracers.

◆ frameEnd()

virtual void sen::kernel::Tracer::frameEnd ( std::string_view name)
pure virtual

Marks the end of a (named) frame. Needs to be paired with a corresponding call to frameStart.

Parameters
nameshould not change for a given frame mark during the program execution.
Note
Only supported by frame-oriented tracers.

◆ message()

virtual void sen::kernel::Tracer::message ( std::string_view name)
pure virtual

Sends a message that will be traced.

Parameters
nameshould not change for a given trace during the program execution.

◆ plot() [1/2]

virtual void sen::kernel::Tracer::plot ( std::string_view name,
float64_t value )
pure virtual

Sends a value that will be plotted.

Parameters
nameshould not change for a given plot during the program execution.
valuea value.
Note
This function might not be available in all tracers.

◆ plot() [2/2]

virtual void sen::kernel::Tracer::plot ( std::string_view name,
int64_t value )
pure virtual

Sends a value that will be plotted.

Parameters
nameshould not change for a given plot during the program execution.
valuea value.
Note
This function might not be available in all tracers.

◆ zoneStart()

virtual void sen::kernel::Tracer::zoneStart ( std::string_view name,
const SourceLocation & location )
protectedpure virtual

◆ zoneEnd()

virtual void sen::kernel::Tracer::zoneEnd ( )
protectedpure virtual

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