diff options
| author | msreis <mateus.sureis@gmail.com> | 2023-03-05 14:37:11 +0200 |
|---|---|---|
| committer | Yuri Sizov <yuris@humnom.net> | 2023-12-19 19:42:21 +0100 |
| commit | f1cc14d5252b1c799a7960b3cced678eebb6ab2a (patch) | |
| tree | 7201aa33bd885f18dc12f3e3949c65e1350ee495 /servers/debugger | |
| parent | 1f5d4a62e9e9a8227ad63155b080fbbfac899571 (diff) | |
| download | redot-engine-f1cc14d5252b1c799a7960b3cced678eebb6ab2a.tar.gz | |
Fix missing time for some script functions in profiler
Fixes the issue by adding a mechanism by which the functions that were
previously disappearing can be profiled too. This is optional with
an editor setting, since collecting more information naturally slows the engine
further while profiling.
Fixes #23715, #40251, #29049
Diffstat (limited to 'servers/debugger')
| -rw-r--r-- | servers/debugger/servers_debugger.cpp | 14 | ||||
| -rw-r--r-- | servers/debugger/servers_debugger.h | 1 |
2 files changed, 11 insertions, 4 deletions
diff --git a/servers/debugger/servers_debugger.cpp b/servers/debugger/servers_debugger.cpp index 9161c5c8b7..bf7dd6c29e 100644 --- a/servers/debugger/servers_debugger.cpp +++ b/servers/debugger/servers_debugger.cpp @@ -108,12 +108,13 @@ Array ServersDebugger::ServersProfilerFrame::serialize() { } } - arr.push_back(script_functions.size() * 4); + arr.push_back(script_functions.size() * 5); for (int i = 0; i < script_functions.size(); i++) { arr.push_back(script_functions[i].sig_id); arr.push_back(script_functions[i].call_count); arr.push_back(script_functions[i].self_time); arr.push_back(script_functions[i].total_time); + arr.push_back(script_functions[i].internal_time); } return arr; } @@ -149,14 +150,15 @@ bool ServersDebugger::ServersProfilerFrame::deserialize(const Array &p_arr) { int func_size = p_arr[idx]; idx += 1; CHECK_SIZE(p_arr, idx + func_size, "ServersProfilerFrame"); - for (int i = 0; i < func_size / 4; i++) { + for (int i = 0; i < func_size / 5; i++) { ScriptFunctionInfo fi; fi.sig_id = p_arr[idx]; fi.call_count = p_arr[idx + 1]; fi.self_time = p_arr[idx + 2]; fi.total_time = p_arr[idx + 3]; + fi.internal_time = p_arr[idx + 4]; script_functions.push_back(fi); - idx += 4; + idx += 5; } CHECK_END(p_arr, idx, "ServersProfilerFrame"); return true; @@ -210,8 +212,11 @@ public: sig_map.clear(); for (int i = 0; i < ScriptServer::get_language_count(); i++) { ScriptServer::get_language(i)->profiling_start(); + if (p_opts.size() == 2 && p_opts[1].get_type() == Variant::BOOL) { + ScriptServer::get_language(i)->profiling_set_save_native_calls(p_opts[1]); + } } - if (p_opts.size() == 1 && p_opts[0].get_type() == Variant::INT) { + if (p_opts.size() > 0 && p_opts[0].get_type() == Variant::INT) { max_frame_functions = MAX(0, int(p_opts[0])); } } else { @@ -265,6 +270,7 @@ public: w[i].call_count = ptrs[i]->call_count; w[i].total_time = ptrs[i]->total_time / 1000000.0; w[i].self_time = ptrs[i]->self_time / 1000000.0; + w[i].internal_time = ptrs[i]->internal_time / 1000000.0; } } diff --git a/servers/debugger/servers_debugger.h b/servers/debugger/servers_debugger.h index c7a11439e0..6efed9f8b9 100644 --- a/servers/debugger/servers_debugger.h +++ b/servers/debugger/servers_debugger.h @@ -69,6 +69,7 @@ public: int call_count = 0; double self_time = 0; double total_time = 0; + double internal_time = 0; }; // Servers profiler |
