mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Make Node::orphan_node_count thread-safe
This commit is contained in:
parent
1ce3101fbc
commit
6ebef31b3c
5 changed files with 25 additions and 9 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue