1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Merge pull request #109900 from Ryan-000/Make-Node-orphan_node_count-thread-safe

Make Node::orphan_node_count thread-safe
This commit is contained in:
Thaddeus Crews
2025-09-30 18:35:13 -05:00
5 changed files with 25 additions and 9 deletions

View File

@@ -141,6 +141,16 @@ int Performance::_get_node_count() const {
return sml->get_node_count();
}
int Performance::_get_orphan_node_count() const {
#ifdef DEBUG_ENABLED
const int total_node_count = Node::total_node_count.get();
const int orphan_node_count = total_node_count - _get_node_count();
return orphan_node_count;
#else
return 0;
#endif
}
String Performance::get_monitor_name(Monitor p_monitor) const {
ERR_FAIL_INDEX_V(p_monitor, MONITOR_MAX, String());
static const char *names[MONITOR_MAX] = {
@@ -240,7 +250,7 @@ double Performance::get_monitor(Monitor p_monitor) const {
case OBJECT_NODE_COUNT:
return _get_node_count();
case OBJECT_ORPHAN_NODE_COUNT:
return Node::orphan_node_count;
return _get_orphan_node_count();
case RENDER_TOTAL_OBJECTS_IN_FRAME:
return RS::get_singleton()->get_rendering_info(RS::RENDERING_INFO_TOTAL_OBJECTS_IN_FRAME);
case RENDER_TOTAL_PRIMITIVES_IN_FRAME:

View File

@@ -46,6 +46,7 @@ class Performance : public Object {
static void _bind_methods();
int _get_node_count() const;
int _get_orphan_node_count() const;
double _process_time;
double _physics_process_time;