diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs index 4d1199449..ae191680c 100644 --- a/Dalamud/Interface/Internal/DalamudInterface.cs +++ b/Dalamud/Interface/Internal/DalamudInterface.cs @@ -714,6 +714,7 @@ namespace Dalamud.Interface.Internal ImGui.BeginMenu(Util.GetGitHash(), false); ImGui.BeginMenu(this.frameCount.ToString(), false); ImGui.BeginMenu(ImGui.GetIO().Framerate.ToString("F2"), false); + ImGui.BeginMenu($"{Util.FormatBytes(GC.GetTotalMemory(false))} total managed", false); ImGui.EndMainMenuBar(); } diff --git a/Dalamud/Interface/Internal/Windows/SettingsWindow.cs b/Dalamud/Interface/Internal/Windows/SettingsWindow.cs index e33ac4e4c..d7dfc0e07 100644 --- a/Dalamud/Interface/Internal/Windows/SettingsWindow.cs +++ b/Dalamud/Interface/Internal/Windows/SettingsWindow.cs @@ -13,6 +13,7 @@ using Dalamud.Interface.Colors; using Dalamud.Interface.Components; using Dalamud.Interface.Windowing; using Dalamud.Plugin.Internal; +using Dalamud.Utility; using ImGuiNET; namespace Dalamud.Interface.Internal.Windows @@ -197,24 +198,6 @@ namespace Dalamud.Interface.Internal.Windows this.DrawSaveCloseButtons(); } - /// - /// Transform byte count to human readable format. - /// - /// Number of bytes. - /// Human readable version. - private static string FormatBytes(long bytes) - { - string[] suffix = { "B", "KB", "MB", "GB", "TB" }; - int i; - double dblSByte = bytes; - for (i = 0; i < suffix.Length && bytes >= 1024; i++, bytes /= 1024) - { - dblSByte = bytes / 1024.0; - } - - return $"{dblSByte:0.##} {suffix[i]}"; - } - private void DrawGeneralTab() { ImGui.Text(Loc.Localize("DalamudSettingsLanguage", "Language")); @@ -351,7 +334,7 @@ namespace Dalamud.Interface.Internal.Windows ImGuiHelpers.ScaledDummy(12); - ImGui.TextColored(ImGuiColors.DalamudGrey, "Total memory used by Dalamud & Plugins: " + FormatBytes(GC.GetTotalMemory(false))); + ImGui.TextColored(ImGuiColors.DalamudGrey, "Total memory used by Dalamud & Plugins: " + Util.FormatBytes(GC.GetTotalMemory(false))); } private void DrawCustomReposSection() diff --git a/Dalamud/Utility/Util.cs b/Dalamud/Utility/Util.cs index 6f914b918..ca7a30a44 100644 --- a/Dalamud/Utility/Util.cs +++ b/Dalamud/Utility/Util.cs @@ -335,6 +335,24 @@ namespace Dalamud.Utility if (exit) Environment.Exit(-1); } + + /// + /// Transform byte count to human readable format. + /// + /// Number of bytes. + /// Human readable version. + public static string FormatBytes(long bytes) + { + string[] suffix = { "B", "KB", "MB", "GB", "TB" }; + int i; + double dblSByte = bytes; + for (i = 0; i < suffix.Length && bytes >= 1024; i++, bytes /= 1024) + { + dblSByte = bytes / 1024.0; + } + + return $"{dblSByte:0.##} {suffix[i]}"; + } /// /// Retrieve a UTF8 string from a null terminated byte array.