guanaqo develop
Utilities for scientific software
Loading...
Searching...
No Matches
trace.hpp File Reference

Detailed Description

Perfetto tracing macros and session helpers.

Definition in file trace.hpp.

#include <guanaqo/export.h>
#include <guanaqo/preprocessor.h>
#include <guanaqo/pcm/counters.hpp>
#include <perfetto.h>
#include <filesystem>
Include dependency graph for trace.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  guanaqo::trace::ScopedLinalgCounters

Namespaces

namespace  guanaqo
namespace  guanaqo::trace
namespace  guanaqo::trace::detail

Macros

#define GUANAQO_TRACE_LINALG_PRIVATE(name, gflops, uid)
#define GUANAQO_TRACE_LINALG_IMPL(name, gflops)
#define GUANAQO_TRACE_INSTANT_IMPL(name, instance)
#define GUANAQO_TRACE_REGION_IMPL(name, instance)
#define GUANAQO_TRACE_LINALG(name, gflops)
#define GUANAQO_TRACE_INSTANT(name, instance)
#define GUANAQO_TRACE_REGION(name, instance)
#define GUANAQO_TRACE(name, instance, ...)
#define GUANAQO_TRACE_STATIC_STR(s)

Functions

 PERFETTO_DEFINE_CATEGORIES_IN_NAMESPACE (guanaqo::trace, ::perfetto::Category("trace").SetDescription("General trace events for regions of code"), ::perfetto::Category("gflops").SetDescription("Counts the total number of floating point operations"), ::perfetto::Category("pcm").SetDescription("Performance counters for CPU metrics"))
 guanaqo::PERFETTO_USE_CATEGORIES_FROM_NAMESPACE (guanaqo::trace)
void guanaqo::trace::initialize_tracing ()
 Initialize Perfetto for in-process tracing and register guanaqo's track event categories.
std::unique_ptr<::perfetto::TracingSession > guanaqo::trace::start_tracing (uint32_t memory_kb=128 *1024)
 Start a new tracing session with the specified buffer size in KiB.
void guanaqo::trace::abort_tracing (std::unique_ptr<::perfetto::TracingSession > tracing_session)
 Stop the tracing session and discard the trace data.
void guanaqo::trace::stop_tracing (std::unique_ptr<::perfetto::TracingSession > tracing_session, const fs::path &output_path)
 Stop the tracing session and write the trace data to the specified output file.
inline ::perfetto::base::PlatformThreadId guanaqo::trace::detail::get_thread_id_fast ()
auto guanaqo::trace::detail::get_thread_track ()
uint64_t & guanaqo::trace::get_thread_gflop_count ()
 Get a reference to the thread-local GFLOP counter.

Macro Definition Documentation

◆ GUANAQO_TRACE_LINALG_PRIVATE

#define GUANAQO_TRACE_LINALG_PRIVATE ( name,
gflops,
uid )
Value:
uid){}; \
::guanaqo::trace::get_thread_gflop_count() += (gflops); \
TRACE_EVENT("gflops", name, \
GUANAQO_CONCATENATE_TOKENS(ctr_, uid).parent_track)
#define GUANAQO_CONCATENATE_TOKENS(a, b)
Concatenate the given tokens.

Definition at line 100 of file trace.hpp.

◆ GUANAQO_TRACE_LINALG_IMPL

#define GUANAQO_TRACE_LINALG_IMPL ( name,
gflops )
Value:
GUANAQO_TRACE_LINALG_PRIVATE(name, gflops, __COUNTER__)
#define GUANAQO_TRACE_LINALG_PRIVATE(name, gflops, uid)
Definition trace.hpp:100

Definition at line 107 of file trace.hpp.

◆ GUANAQO_TRACE_INSTANT_IMPL

#define GUANAQO_TRACE_INSTANT_IMPL ( name,
instance )
Value:
TRACE_EVENT_INSTANT("trace", name, "instance", instance)

Definition at line 110 of file trace.hpp.

◆ GUANAQO_TRACE_REGION_IMPL

#define GUANAQO_TRACE_REGION_IMPL ( name,
instance )
Value:
TRACE_EVENT("trace", name, "instance", instance)

Definition at line 113 of file trace.hpp.

Function Documentation

◆ PERFETTO_DEFINE_CATEGORIES_IN_NAMESPACE()

PERFETTO_DEFINE_CATEGORIES_IN_NAMESPACE ( guanaqo::trace ,
::perfetto::Category("trace").SetDescription("General trace events for regions of code") ,
::perfetto::Category("gflops").SetDescription("Counts the total number of floating point operations") ,
::perfetto::Category("pcm").SetDescription("Performance counters for CPU metrics")  )