MCPcopy Create free account
hub / github.com/AlexandreRouma/SDRPlusPlus / ShowMetricsWindow

Method ShowMetricsWindow

core/src/imgui/imgui.cpp:10917–11281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10915#endif
10916
10917void ImGui::ShowMetricsWindow(bool* p_open)
10918{
10919 if (!Begin("Dear ImGui Metrics/Debugger", p_open))
10920 {
10921 End();
10922 return;
10923 }
10924
10925 ImGuiContext& g = *GImGui;
10926 ImGuiIO& io = g.IO;
10927 ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig;
10928
10929 // Basic info
10930 Text("Dear ImGui %s", GetVersion());
10931 Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
10932 Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, io.MetricsRenderIndices / 3);
10933 Text("%d active windows (%d visible)", io.MetricsActiveWindows, io.MetricsRenderWindows);
10934 Text("%d active allocations", io.MetricsActiveAllocations);
10935 //SameLine(); if (SmallButton("GC")) { g.GcCompactAll = true; }
10936
10937 Separator();
10938
10939 // Debugging enums
10940 enum { WRT_OuterRect, WRT_OuterRectClipped, WRT_InnerRect, WRT_InnerClipRect, WRT_WorkRect, WRT_Content, WRT_ContentIdeal, WRT_ContentRegionRect, WRT_Count }; // Windows Rect Type
10941 const char* wrt_rects_names[WRT_Count] = { "OuterRect", "OuterRectClipped", "InnerRect", "InnerClipRect", "WorkRect", "Content", "ContentIdeal", "ContentRegionRect" };
10942 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
10943 const char* trt_rects_names[TRT_Count] = { "OuterRect", "InnerRect", "WorkRect", "HostClipRect", "InnerClipRect", "BackgroundClipRect", "ColumnsRect", "ColumnsWorkRect", "ColumnsClipRect", "ColumnsContentHeadersUsed", "ColumnsContentHeadersIdeal", "ColumnsContentFrozen", "ColumnsContentUnfrozen" };
10944 if (cfg->ShowWindowsRectsType < 0)
10945 cfg->ShowWindowsRectsType = WRT_WorkRect;
10946 if (cfg->ShowTablesRectsType < 0)
10947 cfg->ShowTablesRectsType = TRT_WorkRect;
10948
10949 struct Funcs
10950 {
10951 static ImRect GetTableRect(ImGuiTable* table, int rect_type, int n)
10952 {
10953 if (rect_type == TRT_OuterRect) { return table->OuterRect; }
10954 else if (rect_type == TRT_InnerRect) { return table->InnerRect; }
10955 else if (rect_type == TRT_WorkRect) { return table->WorkRect; }
10956 else if (rect_type == TRT_HostClipRect) { return table->HostClipRect; }
10957 else if (rect_type == TRT_InnerClipRect) { return table->InnerClipRect; }
10958 else if (rect_type == TRT_BackgroundClipRect) { return table->BgClipRect; }
10959 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->LastOuterHeight); }
10960 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); }
10961 else if (rect_type == TRT_ColumnsClipRect) { ImGuiTableColumn* c = &table->Columns[n]; return c->ClipRect; }
10962 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->LastFirstRowHeight); } // Note: y1/y2 not always accurate
10963 else if (rect_type == TRT_ColumnsContentHeadersIdeal){ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXHeadersIdeal, table->InnerClipRect.Min.y + table->LastFirstRowHeight); }
10964 else if (rect_type == TRT_ColumnsContentFrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXFrozen, table->InnerClipRect.Min.y + table->LastFirstRowHeight); }
10965 else if (rect_type == TRT_ColumnsContentUnfrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y + table->LastFirstRowHeight, c->ContentMaxXUnfrozen, table->InnerClipRect.Max.y); }
10966 IM_ASSERT(0);
10967 return ImRect();
10968 }
10969
10970 static ImRect GetWindowRect(ImGuiWindow* window, int rect_type)
10971 {
10972 if (rect_type == WRT_OuterRect) { return window->Rect(); }
10973 else if (rect_type == WRT_OuterRectClipped) { return window->OuterRectClipped; }
10974 else if (rect_type == WRT_InnerRect) { return window->InnerRect; }

Callers

nothing calls this directly

Calls 15

BeginFunction · 0.85
EndFunction · 0.85
DebugStartItemPickerFunction · 0.85
MetricsHelpMarkerFunction · 0.85
GetForegroundDrawListFunction · 0.85
ImVec2Function · 0.85
ImFormatStringFunction · 0.85
AddRectMethod · 0.80
GetDrawListCountMethod · 0.80
AddRectFilledMethod · 0.80
AddTextMethod · 0.80

Tested by

no test coverage detected