Display times as milliseconds in the profiler and performance monitors

Small values are easier to read as milliseconds compared to seconds.
This commit is contained in:
Hugo Locurcio 2020-01-24 12:07:38 +01:00
parent 1c6d1fcf95
commit f1d9dbfb08
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
2 changed files with 23 additions and 27 deletions

View file

@ -806,25 +806,25 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
p.write[i] = arr[i];
if (i < perf_items.size()) {
float v = p[i];
String vs = rtos(v);
String tt = vs;
const float value = p[i];
String label = rtos(value);
String tooltip = label;
switch (Performance::MonitorType((int)perf_items[i]->get_metadata(1))) {
case Performance::MONITOR_TYPE_MEMORY: {
vs = String::humanize_size(v);
tt = vs;
label = String::humanize_size(value);
tooltip = label;
} break;
case Performance::MONITOR_TYPE_TIME: {
tt += " seconds";
vs += " s";
label = rtos(value * 1000).pad_decimals(2) + " ms";
tooltip = label;
} break;
default: {
tt += " " + perf_items[i]->get_text(0);
tooltip += " " + perf_items[i]->get_text(0);
} break;
}
perf_items[i]->set_text(1, vs);
perf_items[i]->set_tooltip(1, tt);
perf_items[i]->set_text(1, label);
perf_items[i]->set_tooltip(1, tooltip);
if (p[i] > perf_max[i])
perf_max.write[i] = p[i];
}