mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-16 04:47:45 +01:00
feat: add total memory usage to dev bar
This commit is contained in:
parent
29a39b4be1
commit
1083c2f95e
3 changed files with 21 additions and 19 deletions
|
|
@ -335,6 +335,24 @@ namespace Dalamud.Utility
|
|||
if (exit)
|
||||
Environment.Exit(-1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Transform byte count to human readable format.
|
||||
/// </summary>
|
||||
/// <param name="bytes">Number of bytes.</param>
|
||||
/// <returns>Human readable version.</returns>
|
||||
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]}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve a UTF8 string from a null terminated byte array.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue