18#include <unordered_map>
28 std::vector<pulp::view::motion::GeometryProperty>
properties;
36 std::vector<pulp::view::motion::ScrollProperty>
properties;
51 explicit operator bool() const noexcept {
return trace_id > 0 &&
error.empty(); }
75 std::function<
bool()> authority_live,
76 std::function<std::shared_ptr<void>(
77 std::function<
void()>)> subscribe_authority_end);
81 std::vector<pulp::view::motion::CostSample>
88 int cost_sink_id_ = 0;
90 mutable std::mutex mtx_;
91 std::unordered_map<std::int64_t, pulp::view::motion::TraceHandle> traces_;
92 struct CanonicalTrace {
95 std::function<bool()> authority_live;
96 std::shared_ptr<void> authority_end_subscription;
98 std::unordered_map<std::int64_t, CanonicalTrace> canonical_traces_;
99 std::unordered_map<std::int64_t, std::string> cost_trace_owners_;
100 std::deque<pulp::view::motion::CostSample> recent_cost_samples_;
101 std::string cost_owner_;
102 std::function<bool()> cost_authority_live_;
103 bool tracing_was_enabled_ =
false;
104 bool canonical_tracing_epoch_active_ =
false;
105 bool cost_was_enabled_ =
false;
106 std::int64_t next_inspector_id_ = 1;
117 void prune_inactive_traces();
118 void restore_tracing_if_unused_locked();
std::size_t active_trace_count() const
Number of currently-attached inspector traces.
MotionInspector(pulp::view::View &root, InspectorEventSink event_sink={})
Construct with a root view for node-id lookup and an optional event delivery callback.
InspectorMessage handle(const InspectorMessage &req)
Handle a Motion.* request. Returns response message.
std::vector< pulp::view::motion::CostSample > recent_cost_samples(std::size_t maximum_samples, std::string_view owner) const
MotionTraceAttachResult attach_trace(const MotionTraceSpec &spec, std::string owner, std::function< bool()> authority_live, std::function< std::shared_ptr< void >(std::function< void()>)> subscribe_authority_end)
Transport-independent host operations used by canonical capability executors.
bool end_cost_observation(std::string_view owner)
MotionInspector(const MotionInspector &)=delete
MotionInspector & operator=(const MotionInspector &)=delete
bool detach_trace(std::int64_t trace_id, std::string_view owner)
bool begin_cost_observation(std::string owner, std::function< bool()> authority_live)
Definition motion.hpp:491
Agent-first motion observability: sample view geometry, scroll state, and arbitrary scalar values at ...
Motion cost attribution — correlates render-pass cost and dirty area with the motion traces that were...
Definition agent_context.hpp:7
std::function< void(const InspectorMessage &)> InspectorEventSink
Definition inspector_delivery.hpp:30
GeometrySource
Definition motion.hpp:30
@ Layout
Yoga-computed bounds, ignoring paint-time transforms.
Definition motion.hpp:31
GeometrySpace
Definition motion.hpp:35
@ Window
Currently same as ViewGlobal; reserved for window origin.
Definition motion.hpp:38
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
@ s
Definition input_events.hpp:41
@ e
Definition input_events.hpp:39
A single inspector protocol message (request, response, or event).
Definition protocol.hpp:18
Definition motion_inspector.hpp:25
pulp::view::motion::GeometrySpace space
Definition motion_inspector.hpp:29
pulp::view::motion::GeometrySource source
Definition motion_inspector.hpp:30
std::vector< pulp::view::motion::GeometryProperty > properties
Definition motion_inspector.hpp:28
std::string name
Definition motion_inspector.hpp:26
std::string node_id
Definition motion_inspector.hpp:27
Definition motion_inspector.hpp:46
std::string error
Definition motion_inspector.hpp:48
std::int64_t trace_id
Definition motion_inspector.hpp:47
bool resource_exhausted
Definition motion_inspector.hpp:49
Definition motion_inspector.hpp:39
int fps
Definition motion_inspector.hpp:41
std::vector< MotionScrollMetric > scroll_geometry
Definition motion_inspector.hpp:43
std::string view_name
Definition motion_inspector.hpp:40
std::vector< MotionGeometryMetric > geometry
Definition motion_inspector.hpp:42
Per-frame cost attribution sample.
Definition motion_cost.hpp:39