mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Add an ObjectDB Profiling Tool
A new tab is added to the debugger that can help profile a game's memory usage. Specifically, this lets you save a snapshot of all the objects in a running game's ObjectDB to disk. It then lets you view the snapshot and diff two snapshots against each other. This is meant to work similarly to Chrome's heap snapshot tool or Unity's memory profiler.
This commit is contained in:
parent
4d1f26e1fd
commit
78f1543e35
40 changed files with 4262 additions and 109 deletions
|
|
@ -3326,7 +3326,7 @@ void Node::_set_tree(SceneTree *p_tree) {
|
|||
#ifdef DEBUG_ENABLED
|
||||
static HashMap<ObjectID, List<String>> _print_orphan_nodes_map;
|
||||
|
||||
static void _print_orphan_nodes_routine(Object *p_obj) {
|
||||
static void _print_orphan_nodes_routine(Object *p_obj, void *p_user_data) {
|
||||
Node *n = Object::cast_to<Node>(p_obj);
|
||||
if (!n) {
|
||||
return;
|
||||
|
|
@ -3370,7 +3370,7 @@ void Node::print_orphan_nodes() {
|
|||
_print_orphan_nodes_map.clear();
|
||||
|
||||
// Collect and print information about orphan nodes.
|
||||
ObjectDB::debug_objects(_print_orphan_nodes_routine);
|
||||
ObjectDB::debug_objects(_print_orphan_nodes_routine, nullptr);
|
||||
|
||||
for (const KeyValue<ObjectID, List<String>> &E : _print_orphan_nodes_map) {
|
||||
print_line(itos(E.key) + " - Stray Node: " + E.value.get(0) + " (Type: " + E.value.get(1) + ") (Source:" + E.value.get(2) + ")");
|
||||
|
|
@ -3387,7 +3387,7 @@ TypedArray<int> Node::get_orphan_node_ids() {
|
|||
_print_orphan_nodes_map.clear();
|
||||
|
||||
// Collect and return information about orphan nodes.
|
||||
ObjectDB::debug_objects(_print_orphan_nodes_routine);
|
||||
ObjectDB::debug_objects(_print_orphan_nodes_routine, nullptr);
|
||||
|
||||
for (const KeyValue<ObjectID, List<String>> &E : _print_orphan_nodes_map) {
|
||||
ret.push_back(E.key);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue