Merge pull request #29615 from Calinou/fix-editor-monitor-large-sizes
Fix display of large sizes in the editor monitors
This commit is contained in:
commit
704f2c5d85
2 changed files with 3 additions and 15 deletions
|
@ -3221,7 +3221,7 @@ static int _humanize_digits(int p_num) {
|
||||||
String String::humanize_size(size_t p_size) {
|
String String::humanize_size(size_t p_size) {
|
||||||
|
|
||||||
uint64_t _div = 1;
|
uint64_t _div = 1;
|
||||||
static const char *prefix[] = { " Bytes", " KB", " MB", " GB", "TB", " PB", "HB", "" };
|
static const char *prefix[] = { " Bytes", " KB", " MB", " GB", " TB", " PB", " EB", "" };
|
||||||
int prefix_idx = 0;
|
int prefix_idx = 0;
|
||||||
|
|
||||||
while (p_size > (_div * 1024) && prefix[prefix_idx][0]) {
|
while (p_size > (_div * 1024) && prefix[prefix_idx][0]) {
|
||||||
|
|
|
@ -727,20 +727,8 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
|
||||||
String tt = vs;
|
String tt = vs;
|
||||||
switch (Performance::MonitorType((int)perf_items[i]->get_metadata(1))) {
|
switch (Performance::MonitorType((int)perf_items[i]->get_metadata(1))) {
|
||||||
case Performance::MONITOR_TYPE_MEMORY: {
|
case Performance::MONITOR_TYPE_MEMORY: {
|
||||||
// for the time being, going above GBs is a bad sign.
|
vs = String::humanize_size(v);
|
||||||
String unit = "B";
|
tt = vs;
|
||||||
if ((int)v > 1073741824) {
|
|
||||||
unit = "GB";
|
|
||||||
v /= 1073741824.0;
|
|
||||||
} else if ((int)v > 1048576) {
|
|
||||||
unit = "MB";
|
|
||||||
v /= 1048576.0;
|
|
||||||
} else if ((int)v > 1024) {
|
|
||||||
unit = "KB";
|
|
||||||
v /= 1024.0;
|
|
||||||
}
|
|
||||||
tt += " bytes";
|
|
||||||
vs = String::num(v, 2) + " " + unit;
|
|
||||||
} break;
|
} break;
|
||||||
case Performance::MONITOR_TYPE_TIME: {
|
case Performance::MONITOR_TYPE_TIME: {
|
||||||
tt += " seconds";
|
tt += " seconds";
|
||||||
|
|
Loading…
Reference in a new issue