You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user