MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ scheduler()

InspectResult & MayaFlux::Portal::Forma::Inspector::scheduler ( Surface surface,
LayoutCursor cursor,
float  x_min = -0.95F,
float  x_max = 0.95F,
float  row_h = 0.05F 
)

Inspect the full TaskScheduler state.

Header shows total task count. Each task is a collapsible whose header is the routine's dynamic type name, with name, token, active, and delay context as sub-fields.

Persistent: the first call builds the result against surface and cursor and stores it statically. Subsequent calls return the same result regardless of the supplied surface and cursor; the original window remains the render target. To display on a different surface, the process must be restarted.

Definition at line 59 of file SchedulerQuery.cpp.

63{
65 return *s_scheduler_result;
66 }
67
68 const std::vector<ValueSpec> root_values {
69 ValueSpec {
70 .label = "tasks",
71 .reader = [&m_sched = m_sched] {
72 return std::to_string(m_sched.get_all_tasks().size());
73 },
74 },
75 };
76
77 const auto dims = row_pixel_dims(surface.window(), x_min, x_max, row_h);
78 auto hbuf = make_row_buffer(surface.window(), "TaskScheduler", dims);
79 std::vector<RowBuffer> rbufs;
80 rbufs.reserve(root_values.size());
81 for (const auto& spec : root_values)
82 rbufs.push_back(make_row_buffer(surface.window(), spec.label, dims));
83 auto root_group = make_value_group(root_values, std::move(hbuf), rbufs,
84 surface, cursor, x_min, x_max, row_h, true);
85
86 InspectResult& result = s_scheduler_result.emplace();
87 result.group = std::move(root_group);
88
89 const auto tasks = m_sched.get_all_tasks();
90 for (const auto& entry : tasks) {
91 if (!entry.routine)
92 continue;
93
94 auto task_result = inspect_task(
95 entry, surface, cursor,
96 x_min, x_max, row_h);
97
98 result.group.header.attach(surface.layer(), task_result.group.header.header_id);
99 result.children.push_back(std::move(task_result));
100 }
101
102 return result;
103}
InspectResult tasks(Vruta::ProcessingToken token, Surface &surface, LayoutCursor &cursor, float x_min=-0.95F, float x_max=0.95F, float row_h=0.05F)
Inspect tasks for a specific processing token.
RowBuffer make_row_buffer(const std::shared_ptr< Core::Window > &window, std::string_view text, glm::uvec2 pixel_dims) const
Definition Inspector.cpp:13
InspectResult inspect_task(const Vruta::TaskEntry &entry, Surface &surface, LayoutCursor &cursor, float x_min, float x_max, float row_h)
static std::optional< InspectResult > s_scheduler_result
Vruta::TaskScheduler & m_sched
const std::vector< TaskEntry > & get_all_tasks()
Get all tasks for inspection/debugging.
ValueGroup make_value_group(std::span< const ValueSpec > values, RowBuffer header_buf, std::span< const RowBuffer > row_bufs, Surface &surface, LayoutCursor &cursor, float x_min, float x_max, float row_h, bool initially_open)
Construct a collapsible header followed by N value rows under it.
glm::uvec2 row_pixel_dims(const std::shared_ptr< Core::Window > &window, float x_min, float x_max, float row_h)
Convert an NDC row rect into integer pixel dimensions.

References MayaFlux::Portal::Forma::Collapsible::attach(), MayaFlux::Portal::Forma::InspectResult::children, MayaFlux::Vruta::TaskScheduler::get_all_tasks(), MayaFlux::Portal::Forma::InspectResult::group, MayaFlux::Portal::Forma::ValueGroup::header, inspect_task(), MayaFlux::Portal::Forma::ValueSpec::label, MayaFlux::Portal::Forma::Surface::layer(), m_sched, make_row_buffer(), MayaFlux::Portal::Forma::make_value_group(), MayaFlux::Portal::Forma::row_pixel_dims(), s_scheduler_result, tasks(), and MayaFlux::Portal::Forma::Surface::window().

+ Here is the call graph for this function: