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

The store. One producer (audio thread) and one consumer (drain/owner thread). More...

#include <live_dsp_telemetry.hpp>

Public Member Functions

 LiveDspTelemetryStore ()=default
bool prepare (const LiveDspTelemetryConfig &config, std::span< const LiveDspNodeInfo > nodes)
 Allocate all storage for nodes.size() nodes and the ring.
void set_enabled (bool enabled) noexcept
bool enabled () const noexcept
std::uint32_t node_count () const noexcept
bool prepared () const noexcept
LiveDspTelemetryBlockWriter begin_block (std::uint32_t frame_count, double sample_rate) noexcept
 AUDIO THREAD.
void inject_block (std::span< const std::int64_t > node_ns, std::int64_t graph_elapsed_ns, std::uint32_t frame_count, double sample_rate, std::span< const LiveDspSpectralDiagnostic > spectral={}) noexcept
 AUDIO THREAD (or replay).
std::span< LiveDspSpectralDiagnostic > spectral_scratch () noexcept
std::int64_t * external_record_scratch () noexcept
 AUDIO THREAD.
void drain () noexcept
 NON-RT.
const LiveDspTelemetrySnapshot & latest () const noexcept
 NON-RT, single reader. The latest published snapshot.
std::uint64_t blocks_written () const noexcept
std::uint64_t blocks_dropped () const noexcept

Friends

class LiveDspTelemetryBlockWriter
class LiveDspTelemetryNodeScope

Detailed Description

The store. One producer (audio thread) and one consumer (drain/owner thread).

Constructor & Destructor Documentation

◆ LiveDspTelemetryStore()

pulp::audio::LiveDspTelemetryStore::LiveDspTelemetryStore ( )
default

Member Function Documentation

◆ begin_block()

LiveDspTelemetryBlockWriter pulp::audio::LiveDspTelemetryStore::begin_block ( std::uint32_t frame_count,
double sample_rate )
noexcept

AUDIO THREAD.

Begin a block. Returns an inactive writer if disabled, not prepared, or the ring is full (increments blocks_dropped).

◆ blocks_dropped()

std::uint64_t pulp::audio::LiveDspTelemetryStore::blocks_dropped ( ) const
inlinenoexcept

◆ blocks_written()

std::uint64_t pulp::audio::LiveDspTelemetryStore::blocks_written ( ) const
inlinenoexcept

◆ drain()

void pulp::audio::LiveDspTelemetryStore::drain ( )
noexcept

NON-RT.

Consume all complete block records, update rolling windows, compute percentiles/jitter/attribution, and republish the snapshot.

◆ enabled()

bool pulp::audio::LiveDspTelemetryStore::enabled ( ) const
inlinenoexcept

◆ external_record_scratch()

std::int64_t * pulp::audio::LiveDspTelemetryStore::external_record_scratch ( )
inlinenoexcept

AUDIO THREAD.

A pre-allocated node_count()-sized scratch for the caller to fill with per-node elapsed values before calling inject_block() over it — so a recording site needs no stack VLA and no allocation. Returns nullptr when not prepared. The buffer is owned by the store and reused each block.

◆ inject_block()

void pulp::audio::LiveDspTelemetryStore::inject_block ( std::span< const std::int64_t > node_ns,
std::int64_t graph_elapsed_ns,
std::uint32_t frame_count,
double sample_rate,
std::span< const LiveDspSpectralDiagnostic > spectral = {} )
noexcept

AUDIO THREAD (or replay).

Feed a complete block record with explicit per-node elapsed times, taking the same ring path as begin_block() + node scopes + finish(). RT-safe: no allocation, no locks, drop-on-full. Entries in node_ns beyond node_count() are ignored; missing nodes default to 0. Used both for path-agnostic recording from externally measured per-node timings (e.g. the graph's persistent load measurers, which cover every execution path) and for deterministic tests / replay.

◆ latest()

const LiveDspTelemetrySnapshot & pulp::audio::LiveDspTelemetryStore::latest ( ) const
inlinenoexcept

NON-RT, single reader. The latest published snapshot.

◆ node_count()

std::uint32_t pulp::audio::LiveDspTelemetryStore::node_count ( ) const
inlinenoexcept

◆ prepare()

bool pulp::audio::LiveDspTelemetryStore::prepare ( const LiveDspTelemetryConfig & config,
std::span< const LiveDspNodeInfo > nodes )

Allocate all storage for nodes.size() nodes and the ring.

Control thread only. Returns false on an empty node set or invalid config. Re-preparing resets all state.

◆ prepared()

bool pulp::audio::LiveDspTelemetryStore::prepared ( ) const
inlinenoexcept

◆ set_enabled()

void pulp::audio::LiveDspTelemetryStore::set_enabled ( bool enabled)
inlinenoexcept

◆ spectral_scratch()

std::span< LiveDspSpectralDiagnostic > pulp::audio::LiveDspTelemetryStore::spectral_scratch ( )
inlinenoexcept

◆ LiveDspTelemetryBlockWriter

friend class LiveDspTelemetryBlockWriter
friend

◆ LiveDspTelemetryNodeScope

friend class LiveDspTelemetryNodeScope
friend

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