Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::motion::CostAttributor Class Reference

Process-wide cost attribution stream. More...

#include <motion_cost.hpp>

Public Types

using CostSink = std::function<void(const CostSample&)>

Public Member Functions

void set_enabled (bool on)
 Enable / disable cost emission. Off by default.
bool enabled () const noexcept
void set_probe (CostProbe probe)
 Replace the active render-cost probe.
int add_sink (CostSink sink)
 Add a sink that receives one CostSample per frame while enabled.
void remove_sink (int sink_id)
void clear_sinks ()
void reset ()
 Reset all state (sinks, probe, enabled flag, frame counter).
std::size_t emitted_sample_count () const noexcept
 Cumulative count of CostSamples emitted since reset().

Static Public Member Functions

static CostAttributor & instance ()

Friends

class Coordinator

Detailed Description

Process-wide cost attribution stream.

Off by default. When enabled, subscribes to the Coordinator's bound FrameClock, joins per-frame trace-id activity with the supplied probe's render stats, and emits a CostSample to each registered cost sink.

Cost attribution is independent of Coordinator::tracing_enabled — the attributor reads the same trace registry to populate active_provenance, but its sink fan-out lives on its own channel so cost samples never appear in the event fixture stream.

Member Typedef Documentation

◆ CostSink

using pulp::view::motion::CostAttributor::CostSink = std::function<void(const CostSample&)>

Member Function Documentation

◆ add_sink()

int pulp::view::motion::CostAttributor::add_sink ( CostSink sink)

Add a sink that receives one CostSample per frame while enabled.

Returns an id for later removal.

◆ clear_sinks()

void pulp::view::motion::CostAttributor::clear_sinks ( )

◆ emitted_sample_count()

std::size_t pulp::view::motion::CostAttributor::emitted_sample_count ( ) const
noexcept

Cumulative count of CostSamples emitted since reset().

For tests / diagnostics.

◆ enabled()

bool pulp::view::motion::CostAttributor::enabled ( ) const
noexcept

◆ instance()

CostAttributor & pulp::view::motion::CostAttributor::instance ( )
static

◆ remove_sink()

void pulp::view::motion::CostAttributor::remove_sink ( int sink_id)

◆ reset()

void pulp::view::motion::CostAttributor::reset ( )

Reset all state (sinks, probe, enabled flag, frame counter).

For tests.

◆ set_enabled()

void pulp::view::motion::CostAttributor::set_enabled ( bool on)

Enable / disable cost emission. Off by default.

◆ set_probe()

void pulp::view::motion::CostAttributor::set_probe ( CostProbe probe)

Replace the active render-cost probe.

Defensive: when nullptr (the default) every CostSample reports zeroed render fields.

◆ Coordinator

friend class Coordinator
friend

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