| 22274 | } |
| 22275 | |
| 22276 | void ImGui::ShowMetricsWindow(bool* p_open) |
| 22277 | { |
| 22278 | ImGuiContext& g = *GImGui; |
| 22279 | ImGuiIO& io = g.IO; |
| 22280 | ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig; |
| 22281 | if (cfg->ShowDebugLog) |
| 22282 | ShowDebugLogWindow(&cfg->ShowDebugLog); |
| 22283 | if (cfg->ShowIDStackTool) |
| 22284 | ShowIDStackToolWindow(&cfg->ShowIDStackTool); |
| 22285 | |
| 22286 | if (!Begin("Dear ImGui Metrics/Debugger", p_open) || GetCurrentWindow()->BeginCount > 1) |
| 22287 | { |
| 22288 | End(); |
| 22289 | return; |
| 22290 | } |
| 22291 | |
| 22292 | // [DEBUG] Clear debug breaks hooks after exactly one cycle. |
| 22293 | DebugBreakClearData(); |
| 22294 | |
| 22295 | // Basic info |
| 22296 | Text("Dear ImGui %s (%d)", IMGUI_VERSION, IMGUI_VERSION_NUM); |
| 22297 | if (g.ContextName[0] != 0) |
| 22298 | { |
| 22299 | SameLine(); |
| 22300 | Text("(Context Name: \"%s\")", g.ContextName); |
| 22301 | } |
| 22302 | Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); |
| 22303 | Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, io.MetricsRenderIndices / 3); |
| 22304 | Text("%d visible windows, %d current allocations", io.MetricsRenderWindows, g.DebugAllocInfo.TotalAllocCount - g.DebugAllocInfo.TotalFreeCount); |
| 22305 | //SameLine(); if (SmallButton("GC")) { g.GcCompactAll = true; } |
| 22306 | |
| 22307 | Separator(); |
| 22308 | |
| 22309 | // Debugging enums |
| 22310 | enum { WRT_OuterRect, WRT_OuterRectClipped, WRT_InnerRect, WRT_InnerClipRect, WRT_WorkRect, WRT_Content, WRT_ContentIdeal, WRT_ContentRegionRect, WRT_Count }; // Windows Rect Type |
| 22311 | const char* wrt_rects_names[WRT_Count] = { "OuterRect", "OuterRectClipped", "InnerRect", "InnerClipRect", "WorkRect", "Content", "ContentIdeal", "ContentRegionRect" }; |
| 22312 | enum { TRT_OuterRect, TRT_InnerRect, TRT_WorkRect, TRT_HostClipRect, TRT_InnerClipRect, TRT_BackgroundClipRect, TRT_ColumnsRect, TRT_ColumnsWorkRect, TRT_ColumnsClipRect, TRT_ColumnsContentHeadersUsed, TRT_ColumnsContentHeadersIdeal, TRT_ColumnsContentFrozen, TRT_ColumnsContentUnfrozen, TRT_Count }; // Tables Rect Type |
| 22313 | const char* trt_rects_names[TRT_Count] = { "OuterRect", "InnerRect", "WorkRect", "HostClipRect", "InnerClipRect", "BackgroundClipRect", "ColumnsRect", "ColumnsWorkRect", "ColumnsClipRect", "ColumnsContentHeadersUsed", "ColumnsContentHeadersIdeal", "ColumnsContentFrozen", "ColumnsContentUnfrozen" }; |
| 22314 | if (cfg->ShowWindowsRectsType < 0) |
| 22315 | cfg->ShowWindowsRectsType = WRT_WorkRect; |
| 22316 | if (cfg->ShowTablesRectsType < 0) |
| 22317 | cfg->ShowTablesRectsType = TRT_WorkRect; |
| 22318 | |
| 22319 | struct Funcs |
| 22320 | { |
| 22321 | static ImRect GetTableRect(ImGuiTable* table, int rect_type, int n) |
| 22322 | { |
| 22323 | ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); // Always using last submitted instance |
| 22324 | if (rect_type == TRT_OuterRect) { return table->OuterRect; } |
| 22325 | else if (rect_type == TRT_InnerRect) { return table->InnerRect; } |
| 22326 | else if (rect_type == TRT_WorkRect) { return table->WorkRect; } |
| 22327 | else if (rect_type == TRT_HostClipRect) { return table->HostClipRect; } |
| 22328 | else if (rect_type == TRT_InnerClipRect) { return table->InnerClipRect; } |
| 22329 | else if (rect_type == TRT_BackgroundClipRect) { return table->BgClipRect; } |
| 22330 | else if (rect_type == TRT_ColumnsRect) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->MinX, table->InnerClipRect.Min.y, c->MaxX, table->InnerClipRect.Min.y + table_instance->LastOuterHeight); } |
| 22331 | else if (rect_type == TRT_ColumnsWorkRect) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->WorkRect.Min.y, c->WorkMaxX, table->WorkRect.Max.y); } |
| 22332 | else if (rect_type == TRT_ColumnsClipRect) { ImGuiTableColumn* c = &table->Columns[n]; return c->ClipRect; } |
| 22333 | else if (rect_type == TRT_ColumnsContentHeadersUsed){ ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXHeadersUsed, table->InnerClipRect.Min.y + table_instance->LastTopHeadersRowHeight); } // Note: y1/y2 not always accurate |
nothing calls this directly
no test coverage detected