| 21136 | } |
| 21137 | |
| 21138 | void ImGui::ShowMetricsWindow(bool* p_open) |
| 21139 | { |
| 21140 | ImGuiContext& g = *GImGui; |
| 21141 | ImGuiIO& io = g.IO; |
| 21142 | ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig; |
| 21143 | if (cfg->ShowDebugLog) |
| 21144 | ShowDebugLogWindow(&cfg->ShowDebugLog); |
| 21145 | if (cfg->ShowIDStackTool) |
| 21146 | ShowIDStackToolWindow(&cfg->ShowIDStackTool); |
| 21147 | |
| 21148 | if (!Begin("Dear ImGui Metrics/Debugger", p_open) || GetCurrentWindow()->BeginCount > 1) |
| 21149 | { |
| 21150 | End(); |
| 21151 | return; |
| 21152 | } |
| 21153 | |
| 21154 | // [DEBUG] Clear debug breaks hooks after exactly one cycle. |
| 21155 | DebugBreakClearData(); |
| 21156 | |
| 21157 | // Basic info |
| 21158 | Text("Dear ImGui %s (%d)", IMGUI_VERSION, IMGUI_VERSION_NUM); |
| 21159 | if (g.ContextName[0] != 0) |
| 21160 | { |
| 21161 | SameLine(); |
| 21162 | Text("(Context Name: \"%s\")", g.ContextName); |
| 21163 | } |
| 21164 | Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); |
| 21165 | Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, io.MetricsRenderIndices / 3); |
| 21166 | Text("%d visible windows, %d current allocations", io.MetricsRenderWindows, g.DebugAllocInfo.TotalAllocCount - g.DebugAllocInfo.TotalFreeCount); |
| 21167 | //SameLine(); if (SmallButton("GC")) { g.GcCompactAll = true; } |
| 21168 | |
| 21169 | Separator(); |
| 21170 | |
| 21171 | // Debugging enums |
| 21172 | enum { WRT_OuterRect, WRT_OuterRectClipped, WRT_InnerRect, WRT_InnerClipRect, WRT_WorkRect, WRT_Content, WRT_ContentIdeal, WRT_ContentRegionRect, WRT_Count }; // Windows Rect Type |
| 21173 | const char* wrt_rects_names[WRT_Count] = { "OuterRect", "OuterRectClipped", "InnerRect", "InnerClipRect", "WorkRect", "Content", "ContentIdeal", "ContentRegionRect" }; |
| 21174 | 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 |
| 21175 | const char* trt_rects_names[TRT_Count] = { "OuterRect", "InnerRect", "WorkRect", "HostClipRect", "InnerClipRect", "BackgroundClipRect", "ColumnsRect", "ColumnsWorkRect", "ColumnsClipRect", "ColumnsContentHeadersUsed", "ColumnsContentHeadersIdeal", "ColumnsContentFrozen", "ColumnsContentUnfrozen" }; |
| 21176 | if (cfg->ShowWindowsRectsType < 0) |
| 21177 | cfg->ShowWindowsRectsType = WRT_WorkRect; |
| 21178 | if (cfg->ShowTablesRectsType < 0) |
| 21179 | cfg->ShowTablesRectsType = TRT_WorkRect; |
| 21180 | |
| 21181 | struct Funcs |
| 21182 | { |
| 21183 | static ImRect GetTableRect(ImGuiTable* table, int rect_type, int n) |
| 21184 | { |
| 21185 | ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); // Always using last submitted instance |
| 21186 | if (rect_type == TRT_OuterRect) { return table->OuterRect; } |
| 21187 | else if (rect_type == TRT_InnerRect) { return table->InnerRect; } |
| 21188 | else if (rect_type == TRT_WorkRect) { return table->WorkRect; } |
| 21189 | else if (rect_type == TRT_HostClipRect) { return table->HostClipRect; } |
| 21190 | else if (rect_type == TRT_InnerClipRect) { return table->InnerClipRect; } |
| 21191 | else if (rect_type == TRT_BackgroundClipRect) { return table->BgClipRect; } |
| 21192 | 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); } |
| 21193 | 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); } |
| 21194 | else if (rect_type == TRT_ColumnsClipRect) { ImGuiTableColumn* c = &table->Columns[n]; return c->ClipRect; } |
| 21195 | 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