diff options
Diffstat (limited to 'main/performance.cpp')
-rw-r--r-- | main/performance.cpp | 115 |
1 files changed, 85 insertions, 30 deletions
diff --git a/main/performance.cpp b/main/performance.cpp index bdcd07a216..e24a3673b9 100644 --- a/main/performance.cpp +++ b/main/performance.cpp @@ -1,32 +1,32 @@ -/*************************************************************************/ -/* performance.cpp */ -/*************************************************************************/ -/* 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. */ -/*************************************************************************/ +/**************************************************************************/ +/* performance.cpp */ +/**************************************************************************/ +/* 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. */ +/**************************************************************************/ #include "performance.h" @@ -36,6 +36,7 @@ #include "scene/main/node.h" #include "scene/main/scene_tree.h" #include "servers/audio_server.h" +#include "servers/navigation_server_3d.h" #include "servers/physics_server_2d.h" #include "servers/physics_server_3d.h" #include "servers/rendering_server.h" @@ -54,6 +55,7 @@ void Performance::_bind_methods() { BIND_ENUM_CONSTANT(TIME_FPS); BIND_ENUM_CONSTANT(TIME_PROCESS); BIND_ENUM_CONSTANT(TIME_PHYSICS_PROCESS); + BIND_ENUM_CONSTANT(TIME_NAVIGATION_PROCESS); BIND_ENUM_CONSTANT(MEMORY_STATIC); BIND_ENUM_CONSTANT(MEMORY_STATIC_MAX); BIND_ENUM_CONSTANT(MEMORY_MESSAGE_BUFFER_MAX); @@ -74,7 +76,15 @@ void Performance::_bind_methods() { BIND_ENUM_CONSTANT(PHYSICS_3D_COLLISION_PAIRS); BIND_ENUM_CONSTANT(PHYSICS_3D_ISLAND_COUNT); BIND_ENUM_CONSTANT(AUDIO_OUTPUT_LATENCY); - + BIND_ENUM_CONSTANT(NAVIGATION_ACTIVE_MAPS); + BIND_ENUM_CONSTANT(NAVIGATION_REGION_COUNT); + BIND_ENUM_CONSTANT(NAVIGATION_AGENT_COUNT); + BIND_ENUM_CONSTANT(NAVIGATION_LINK_COUNT); + BIND_ENUM_CONSTANT(NAVIGATION_POLYGON_COUNT); + BIND_ENUM_CONSTANT(NAVIGATION_EDGE_COUNT); + BIND_ENUM_CONSTANT(NAVIGATION_EDGE_MERGE_COUNT); + BIND_ENUM_CONSTANT(NAVIGATION_EDGE_CONNECTION_COUNT); + BIND_ENUM_CONSTANT(NAVIGATION_EDGE_FREE_COUNT); BIND_ENUM_CONSTANT(MONITOR_MAX); } @@ -93,6 +103,7 @@ String Performance::get_monitor_name(Monitor p_monitor) const { "time/fps", "time/process", "time/physics_process", + "time/navigation_process", "memory/static", "memory/static_max", "memory/msg_buf_max", @@ -113,6 +124,15 @@ String Performance::get_monitor_name(Monitor p_monitor) const { "physics_3d/collision_pairs", "physics_3d/islands", "audio/driver/output_latency", + "navigation/active_maps", + "navigation/regions", + "navigation/agents", + "navigation/links", + "navigation/polygons", + "navigation/edges", + "navigation/edges_merged", + "navigation/edges_connected", + "navigation/edges_free", }; @@ -127,6 +147,8 @@ double Performance::get_monitor(Monitor p_monitor) const { return _process_time; case TIME_PHYSICS_PROCESS: return _physics_process_time; + case TIME_NAVIGATION_PROCESS: + return _navigation_process_time; case MEMORY_STATIC: return Memory::get_mem_usage(); case MEMORY_STATIC_MAX: @@ -167,6 +189,24 @@ double Performance::get_monitor(Monitor p_monitor) const { return PhysicsServer3D::get_singleton()->get_process_info(PhysicsServer3D::INFO_ISLAND_COUNT); case AUDIO_OUTPUT_LATENCY: return AudioServer::get_singleton()->get_output_latency(); + case NAVIGATION_ACTIVE_MAPS: + return NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_ACTIVE_MAPS); + case NAVIGATION_REGION_COUNT: + return NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_REGION_COUNT); + case NAVIGATION_AGENT_COUNT: + return NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_AGENT_COUNT); + case NAVIGATION_LINK_COUNT: + return NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_LINK_COUNT); + case NAVIGATION_POLYGON_COUNT: + return NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_POLYGON_COUNT); + case NAVIGATION_EDGE_COUNT: + return NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_EDGE_COUNT); + case NAVIGATION_EDGE_MERGE_COUNT: + return NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_EDGE_MERGE_COUNT); + case NAVIGATION_EDGE_CONNECTION_COUNT: + return NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_EDGE_CONNECTION_COUNT); + case NAVIGATION_EDGE_FREE_COUNT: + return NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_EDGE_FREE_COUNT); default: { } @@ -182,6 +222,7 @@ Performance::MonitorType Performance::get_monitor_type(Monitor p_monitor) const MONITOR_TYPE_QUANTITY, MONITOR_TYPE_TIME, MONITOR_TYPE_TIME, + MONITOR_TYPE_TIME, MONITOR_TYPE_MEMORY, MONITOR_TYPE_MEMORY, MONITOR_TYPE_MEMORY, @@ -202,6 +243,15 @@ Performance::MonitorType Performance::get_monitor_type(Monitor p_monitor) const MONITOR_TYPE_QUANTITY, MONITOR_TYPE_QUANTITY, MONITOR_TYPE_TIME, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, }; @@ -216,6 +266,10 @@ void Performance::set_physics_process_time(double p_pt) { _physics_process_time = p_pt; } +void Performance::set_navigation_process_time(double p_pt) { + _navigation_process_time = p_pt; +} + void Performance::add_custom_monitor(const StringName &p_id, const Callable &p_callable, const Vector<Variant> &p_args) { ERR_FAIL_COND_MSG(has_custom_monitor(p_id), "Custom monitor with id '" + String(p_id) + "' already exists."); _monitor_map.insert(p_id, MonitorCall(p_callable, p_args)); @@ -262,6 +316,7 @@ uint64_t Performance::get_monitor_modification_time() { Performance::Performance() { _process_time = 0; _physics_process_time = 0; + _navigation_process_time = 0; _monitor_modification_time = 0; singleton = this; } |