summaryrefslogtreecommitdiff
path: root/editor/debugger/editor_profiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'editor/debugger/editor_profiler.h')
-rw-r--r--editor/debugger/editor_profiler.h112
1 files changed, 57 insertions, 55 deletions
diff --git a/editor/debugger/editor_profiler.h b/editor/debugger/editor_profiler.h
index 45f7ac39c1..eea8ed8365 100644
--- a/editor/debugger/editor_profiler.h
+++ b/editor/debugger/editor_profiler.h
@@ -1,35 +1,35 @@
-/*************************************************************************/
-/* editor_profiler.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef EDITORPROFILER_H
-#define EDITORPROFILER_H
+/**************************************************************************/
+/* editor_profiler.h */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/**************************************************************************/
+
+#ifndef EDITOR_PROFILER_H
+#define EDITOR_PROFILER_H
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
@@ -49,7 +49,7 @@ public:
int frame_number = 0;
float frame_time = 0;
- float idle_time = 0;
+ float process_time = 0;
float physics_time = 0;
float physics_frame_time = 0;
@@ -73,8 +73,8 @@ public:
Vector<Category> categories;
- Map<StringName, Category *> category_ptrs;
- Map<StringName, Category::Item *> item_ptrs;
+ HashMap<StringName, Category *> category_ptrs;
+ HashMap<StringName, Category::Item *> item_ptrs;
};
enum DisplayMode {
@@ -90,38 +90,39 @@ public:
};
private:
- Button *activate;
- Button *clear_button;
- TextureRect *graph;
+ Button *activate = nullptr;
+ Button *clear_button = nullptr;
+ TextureRect *graph = nullptr;
Ref<ImageTexture> graph_texture;
Vector<uint8_t> graph_image;
- Tree *variables;
- HSplitContainer *h_split;
+ Tree *variables = nullptr;
+ HSplitContainer *h_split = nullptr;
- Set<StringName> plot_sigs;
+ HashSet<StringName> plot_sigs;
- OptionButton *display_mode;
- OptionButton *display_time;
+ OptionButton *display_mode = nullptr;
+ OptionButton *display_time = nullptr;
- SpinBox *cursor_metric_edit;
+ SpinBox *cursor_metric_edit = nullptr;
Vector<Metric> frame_metrics;
- int total_metrics;
- int last_metric;
+ int total_metrics = 0;
+ int last_metric = -1;
- int max_functions;
+ int max_functions = 0;
- bool updating_frame;
+ bool updating_frame = false;
- int hover_metric;
+ int hover_metric = -1;
- float graph_height;
+ float graph_height = 1.0f;
- bool seeking;
+ bool seeking = false;
- Timer *frame_delay;
- Timer *plot_delay;
+ Timer *frame_delay = nullptr;
+ Timer *plot_delay = nullptr;
+ void _update_button_text();
void _update_frame();
void _activate_pressed();
@@ -153,7 +154,8 @@ protected:
public:
void add_frame_metric(const Metric &p_metric, bool p_final = false);
- void set_enabled(bool p_enable);
+ void set_enabled(bool p_enable, bool p_clear = true);
+ void set_pressed(bool p_pressed);
bool is_profiling();
bool is_seeking() { return seeking; }
void disable_seeking();
@@ -165,4 +167,4 @@ public:
EditorProfiler();
};
-#endif // EDITORPROFILER_H
+#endif // EDITOR_PROFILER_H