taskflow 接入异步 datoviz性能监测

This commit is contained in:
2026-08-15 02:12:03 +08:00
parent 2c7c8abd4f
commit 282768e0ea
36 changed files with 1890 additions and 234 deletions
@@ -67,18 +67,21 @@ TEST(render_dag_test, analysis_derives_wait_critical_path_and_parallel_overlap_f
snapshot.render_start_ns = 100;
snapshot.render_end_ns = 200;
snapshot.node_executions.resize(plan->graph.nodes.size());
auto complete = [&snapshot, &plan](std::size_t slot, std::uint64_t start,
std::uint64_t end, std::uint32_t worker) {
auto complete = [&snapshot, &plan](std::size_t slot, std::uint64_t ready,
std::uint64_t start, std::uint64_t end,
std::uint32_t worker) {
auto* execution = &snapshot.node_executions.at(slot);
execution->node_id = plan->graph.nodes.at(slot).node_id;
execution->ready_time_ns = ready;
execution->start_time_ns = start;
execution->cpu_end_time_ns = end;
execution->end_time_ns = end;
execution->worker_id = worker;
execution->status = Node_Execution_Status::complete;
};
complete(0, 110, 150, 0);
complete(1, 115, 145, 1);
complete(2, 160, 190, 1);
complete(0, 100, 110, 150, 0);
complete(1, 100, 115, 145, 1);
complete(2, 150, 160, 190, 1);
const auto analysis = analyze_frame(*plan, snapshot);
ASSERT_EQ(analysis.nodes.size(), 3u);
@@ -124,7 +127,9 @@ TEST(render_dag_test, capture_controller_and_repository_capture_exact_requested_
for (std::size_t slot = 0; slot < plan->graph.nodes.size(); ++slot) {
auto* execution = &snapshot->node_executions.at(slot);
execution->node_id = plan->graph.nodes.at(slot).node_id;
execution->ready_time_ns = frame_id * 100;
execution->start_time_ns = frame_id * 100 + slot * 10;
execution->cpu_end_time_ns = execution->start_time_ns + 5;
execution->end_time_ns = execution->start_time_ns + 5;
execution->worker_id = static_cast<std::uint32_t>(slot);
execution->status = Node_Execution_Status::complete;
@@ -141,6 +146,43 @@ TEST(render_dag_test, capture_controller_and_repository_capture_exact_requested_
EXPECT_EQ(session->frames[1].snapshot->frame_id, 2u);
}
TEST(render_dag_test,
external_wait_contributes_to_wall_path_but_not_cpu_worker_utilization) {
Render_Graph_Builder builder;
builder.emplace(201, 20, "GPU Render", Render_Node_Kind::render);
Render_Plan_History history;
const auto plan = history.publish(std::move(builder).finish());
Frame_Snapshot snapshot;
snapshot.frame_id = 7;
snapshot.render_plan_version = plan->version;
snapshot.render_start_ns = 1'000;
snapshot.render_end_ns = 1'200;
snapshot.node_executions.resize(1);
auto& execution = snapshot.node_executions.front();
execution.node_id = 201;
execution.ready_time_ns = 1'000;
execution.start_time_ns = 1'000;
execution.cpu_end_time_ns = 1'020;
execution.external_start_time_ns = 1'020;
execution.external_end_time_ns = 1'200;
execution.end_time_ns = 1'200;
execution.worker_id = 3;
execution.status = Node_Execution_Status::complete;
const auto analysis = analyze_frame(*plan, snapshot);
ASSERT_EQ(analysis.nodes.size(), 1U);
EXPECT_EQ(analysis.nodes.front().duration_ns, 200U);
EXPECT_EQ(analysis.nodes.front().cpu_duration_ns, 20U);
EXPECT_EQ(analysis.nodes.front().external_duration_ns, 180U);
EXPECT_EQ(analysis.total_work_duration_ns, 20U);
EXPECT_EQ(analysis.total_external_duration_ns, 180U);
EXPECT_EQ(analysis.critical_path_duration_ns, 200U);
ASSERT_EQ(analysis.workers.size(), 1U);
EXPECT_EQ(analysis.workers.front().work_duration_ns, 20U);
EXPECT_DOUBLE_EQ(analysis.workers.front().utilization, 0.1);
}
TEST(render_dag_test, failed_capture_ticket_is_retried_until_the_requested_frame_completes) {
Capture_Controller controller;
const auto session_id = controller.capture_next_frame();