summaryrefslogtreecommitdiffstats
path: root/editor/debugger/editor_profiler.cpp
diff options
context:
space:
mode:
authormsreis <mateus.sureis@gmail.com>2023-03-05 14:37:11 +0200
committerYuri Sizov <yuris@humnom.net>2023-12-19 19:42:21 +0100
commitf1cc14d5252b1c799a7960b3cced678eebb6ab2a (patch)
tree7201aa33bd885f18dc12f3e3949c65e1350ee495 /editor/debugger/editor_profiler.cpp
parent1f5d4a62e9e9a8227ad63155b080fbbfac899571 (diff)
downloadredot-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 'editor/debugger/editor_profiler.cpp')
-rw-r--r--editor/debugger/editor_profiler.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp
index f72538e3de..d54fd62e8c 100644
--- a/editor/debugger/editor_profiler.cpp
+++ b/editor/debugger/editor_profiler.cpp
@@ -97,6 +97,7 @@ void EditorProfiler::clear() {
plot_sigs.clear();
plot_sigs.insert("physics_frame_time");
plot_sigs.insert("category_frame_time");
+ display_internal_profiles->set_visible(EDITOR_GET("debugger/profile_native_calls"));
updating_frame = true;
cursor_metric_edit->set_min(0);
@@ -352,6 +353,9 @@ void EditorProfiler::_update_frame() {
for (int j = m.categories[i].items.size() - 1; j >= 0; j--) {
const Metric::Category::Item &it = m.categories[i].items[j];
+ if (it.internal == it.total && !display_internal_profiles->is_pressed() && m.categories[i].name == "Script Functions") {
+ continue;
+ }
TreeItem *item = variables->create_item(category);
item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
item->set_editable(0, true);
@@ -363,6 +367,9 @@ void EditorProfiler::_update_frame() {
item->set_tooltip_text(0, it.name + "\n" + it.script + ":" + itos(it.line));
float time = dtime == DISPLAY_SELF_TIME ? it.self : it.total;
+ if (dtime == DISPLAY_SELF_TIME && !display_internal_profiles->is_pressed()) {
+ time += it.internal;
+ }
item->set_text(1, _get_time_as_text(m, time, it.calls));
@@ -404,6 +411,10 @@ void EditorProfiler::_clear_pressed() {
_update_plot();
}
+void EditorProfiler::_internal_profiles_pressed() {
+ _combo_changed(0);
+}
+
void EditorProfiler::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
@@ -635,6 +646,11 @@ EditorProfiler::EditorProfiler() {
hb->add_child(display_time);
+ display_internal_profiles = memnew(CheckButton(TTR("Display internal functions")));
+ display_internal_profiles->set_pressed(false);
+ display_internal_profiles->connect("pressed", callable_mp(this, &EditorProfiler::_internal_profiles_pressed));
+ hb->add_child(display_internal_profiles);
+
hb->add_spacer();
hb->add_child(memnew(Label(TTR("Frame #:"))));