123 CostAttributor(const CostAttributor&) = delete;
124 CostAttributor& operator=(const CostAttributor&) = delete;
131 void note_tick_begin(
std::uint64_t frame,
double t_seconds);
132 void note_trace_activity(
int trace_id);
133 void note_provenance(
int trace_id, const
Provenance& prov);
137 std::unique_ptr<State> state_;
Process-wide cost attribution stream.
Definition motion_cost.hpp:92
void set_enabled(bool on)
Enable / disable cost emission. Off by default.
int add_sink(CostSink sink)
Add a sink that receives one CostSample per frame while enabled.
void reset()
Reset all state (sinks, probe, enabled flag, frame counter).
void remove_sink(int sink_id)
void set_probe(CostProbe probe)
Replace the active render-cost probe.
std::function< void(const CostSample &)> CostSink
Definition motion_cost.hpp:94
bool enabled() const noexcept
friend class Coordinator
Definition motion_cost.hpp:126
std::size_t emitted_sample_count() const noexcept
Cumulative count of CostSamples emitted since reset().
static CostAttributor & instance()
Agent-first motion observability: sample view geometry, scroll state, and arbitrary scalar values at ...
CostAttributor::CostSink make_cost_buffer_sink(std::vector< CostSample > *buffer)
Sink that appends each CostSample to a caller-owned buffer.
std::string serialize_cost_sample(const CostSample &s)
Serialize one CostSample as a single JSON line (without trailing newline).
std::vector< CostSample > load_cost_stream(const std::string &path)
Parse a JSONL CostSample stream from path.
CostAttributor::CostSink make_cost_sink(std::string path)
Sink that appends each CostSample as a JSONL line to path.
constexpr int kCostSchemaVersion
Definition motion_cost.hpp:33
std::function< RenderCostSnapshot()> CostProbe
Definition motion_cost.hpp:78
@ path
Definition anchor_strategy.hpp:42
@ s
Definition input_events.hpp:41
@ on
Definition accessibility.hpp:132
Per-frame cost attribution sample.
Definition motion_cost.hpp:39
double t_seconds
Definition motion_cost.hpp:41
double dirty_rect_area_px
Total area (in pixels^2) of all dirty rectangles snapshotted from DirtyTracker::dirty_rects().
Definition motion_cost.hpp:51
std::uint64_t frame
Definition motion_cost.hpp:40
std::vector< Provenance > active_provenance
Provenance envelopes for each entry in active_trace_ids, in the same order.
Definition motion_cost.hpp:64
std::vector< int > active_trace_ids
Trace ids that emitted at least one SampleEvent on this frame.
Definition motion_cost.hpp:59
double render_pass_duration_ms
Wall time spent in the most recently completed render pass.
Definition motion_cost.hpp:47
int dirty_rect_count
Number of dirty rectangles snapshotted this frame.
Definition motion_cost.hpp:55
Snapshot of render-layer cost for the current frame.
Definition motion_cost.hpp:72
double render_pass_duration_ms
Definition motion_cost.hpp:73
int dirty_rect_count
Definition motion_cost.hpp:75
double dirty_rect_area_px
Definition motion_cost.hpp:74