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 |
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.
| using pulp::view::motion::CostAttributor::CostSink = std::function<void(const CostSample&)> |
| 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.
| void pulp::view::motion::CostAttributor::clear_sinks | ( | ) |
|
noexcept |
Cumulative count of CostSamples emitted since reset().
For tests / diagnostics.
|
noexcept |
|
static |
| void pulp::view::motion::CostAttributor::remove_sink | ( | int | sink_id | ) |
| void pulp::view::motion::CostAttributor::reset | ( | ) |
Reset all state (sinks, probe, enabled flag, frame counter).
For tests.
| void pulp::view::motion::CostAttributor::set_enabled | ( | bool | on | ) |
Enable / disable cost emission. Off by default.
| 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.
|
friend |