8#ifndef SEN_KERNEL_TRACER_H
9#define SEN_KERNEL_TRACER_H
94 virtual void frameEnd(std::string_view name) = 0;
99 virtual void message(std::string_view name) = 0;
111 virtual void plot(std::string_view name, int64_t value) = 0;
119using TracerFactory = std::function<std::unique_ptr<Tracer>(std::string_view)>;
136#define SEN_TRACE_ZONE_NAMED(tracer, name) static constexpr auto __senSourceLocation ## __LINE__ = SEN_SL(); auto __senScopedZone ## __LINE__ = (tracer).makeScopedZone(name, __senSourceLocation ## __LINE__)
149#define SEN_TRACE_ZONE(tracer) static constexpr auto __senSourceLocation ## __LINE__ = SEN_SL(); auto __senScopedZone ## __LINE__ = (tracer).makeScopedZone(__senSourceLocation ## __LINE__)
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 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 message(std::string_view name)=0
Sends a message that will be traced.
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
virtual ~Tracer()=default
virtual void zoneStart(std::string_view name, const SourceLocation &location)=0
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.
auto makeScopeGuard(F &&f)
Makes scope guard from a callable taking no arguments.
double float64_t
Definition numbers.h:17
Represents a location in source code.
Definition source_location.h:54
Strong type for the unique identifier for a transport timer.
Definition native_object_impl.h:39
std::function< std::unique_ptr< Tracer >(std::string_view)> TracerFactory
A factory function for tracers.
Definition tracer.h:119
TracerFactory getDefaultTracerFactory()
A function that returns a no-op tracer.