mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
feat: show total CLR memory usage in settings
This commit is contained in:
parent
7a573eaf62
commit
c6024c723d
1 changed files with 20 additions and 0 deletions
|
|
@ -197,6 +197,24 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
this.DrawSaveCloseButtons();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Transform byte count to human readable format.
|
||||
/// </summary>
|
||||
/// <param name="bytes">Number of bytes.</param>
|
||||
/// <returns>Human readable version.</returns>
|
||||
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"));
|
||||
|
|
@ -332,6 +350,8 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
this.DrawDevPluginLocationsSection();
|
||||
|
||||
ImGuiHelpers.ScaledDummy(12);
|
||||
|
||||
ImGui.TextColored(ImGuiColors.DalamudGrey, "Total memory used by Dalamud & Plugins: " + FormatBytes(GC.GetTotalMemory(false)));
|
||||
}
|
||||
|
||||
private void DrawCustomReposSection()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue