mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Add NavigationServer Performance Monitor
Adds Performance Monitor for NavigationServer3D.
This commit is contained in:
parent
bb08997b87
commit
9802914f97
11 changed files with 315 additions and 22 deletions
|
@ -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,12 @@ 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,
|
||||
|
||||
};
|
||||
|
||||
|
@ -216,6 +263,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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue