13#include "../third_party/imgui/imgui.h"
71 if (!
prof.IsProfiling())
73 if (ImGui::Button(
"▶ Start Profiling"))
74 prof.BeginProfiling();
78 if (ImGui::Button(
"⏹ Stop Profiling"))
84 if (ImGui::Button(
"Clear##profClear"))
90 if (ImGui::Button(
"Export CSV"))
93 std::time_t
t = std::time(
nullptr);
104 std::string
csvPath = std::string(
"profiler_export_") +
timeBuf +
".csv";
106 ImGui::OpenPopup(
"ExportOK");
108 ImGui::OpenPopup(
"ExportFail");
111 if (ImGui::BeginPopup(
"ExportOK"))
113 ImGui::Text(
"CSV exported successfully.");
114 if (ImGui::Button(
"OK")) ImGui::CloseCurrentPopup();
117 if (ImGui::BeginPopup(
"ExportFail"))
119 ImGui::TextColored(
ImVec4(1,0,0,1),
"Export failed.");
120 if (ImGui::Button(
"OK")) ImGui::CloseCurrentPopup();
125 ImGui::SetNextItemWidth(80.0f);
129 ImGui::Checkbox(
"Auto Scroll##profScroll", &
m_autoScroll);
138 ImGui::TextDisabled(
"Frame Timeline");
145 ImGui::TextDisabled(
"(no frame data — start profiling)");
149 ImGui::BeginChild(
"FrameTimeline",
ImVec2(0, 160),
true,
155 ImGui::Text(
"F%llu (%.1fms):",
156 static_cast<unsigned long long>(frame.
frameNumber),
165 int barLen =
static_cast<int>(
m.executionTimeMs * 4.0f);
172 ImGui::TextColored(
ImVec4(1.0f, 0.4f, 0.4f, 1.0f),
173 " Node %-3d %-18s %s %.2fms",
174 m.nodeID,
m.nodeName.c_str(),
175 bar.c_str(),
m.executionTimeMs);
177 ImGui::Text(
" Node %-3d %-18s %s %.2fms",
178 m.nodeID,
m.nodeName.c_str(),
179 bar.c_str(),
m.executionTimeMs);
183 if (
m_autoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY())
184 ImGui::SetScrollHereY(1.0f);
195 ImGui::TextDisabled(
"Hotspot Table (sorted by avgTimeMs ▼)");
202 ImGui::TextDisabled(
"(no data)");
206 ImGui::BeginChild(
"HotspotTable",
ImVec2(0, 180),
true);
208 ImGui::Text(
"%-6s %-24s %9s %9s %9s",
209 "NodeID",
"Name",
"AvgMs",
"MaxMs",
"Count");
218 ImGui::TextColored(
ImVec4(1.0f, 0.3f, 0.3f, 1.0f),
219 "%-6d %-24s %9.3f %9.3f %9llu",
220 m.nodeID,
m.nodeName.c_str(),
221 m.avgTimeMs,
m.maxTimeMs,
m.executionCount);
223 ImGui::Text(
"%-6d %-24s %9.3f %9.3f %9llu",
224 m.nodeID,
m.nodeName.c_str(),
225 m.avgTimeMs,
m.maxTimeMs,
m.executionCount);
ComponentTypeID GetComponentTypeID_Static()
ImGui profiler panel for ATS VS node execution metrics (Phase 5).
int m_historyCount
Frames shown in timeline.
void Render()
Renders the profiler panel window.
void RenderHotspotTable()
void RenderFrameTimeline()
< Provides AssetID and INVALID_ASSET_ID
Snapshot of all node metrics for a single frame.
std::vector< NodeExecutionMetrics > nodeMetrics
Accumulated per-node execution statistics.
float avgTimeMs
Running average execution time (ms)