You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Fix display of large sizes in the editor monitors
Unlike the old custom method, the `String::humanize_size()` method works well with file sizes above 2 GB. This also tweaks the suffixes for spacing consistency and uses the correct acronym for exabytes (EB). This closes #29610.
This commit is contained in:
@@ -727,20 +727,8 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
|
||||
String tt = vs;
|
||||
switch (Performance::MonitorType((int)perf_items[i]->get_metadata(1))) {
|
||||
case Performance::MONITOR_TYPE_MEMORY: {
|
||||
// for the time being, going above GBs is a bad sign.
|
||||
String unit = "B";
|
||||
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;
|
||||
vs = String::humanize_size(v);
|
||||
tt = vs;
|
||||
} break;
|
||||
case Performance::MONITOR_TYPE_TIME: {
|
||||
tt += " seconds";
|
||||
|
||||
Reference in New Issue
Block a user