Added in missing changes from Add NavigationServer Performance Monitor

Adds Performance Monitor for NavigationServer3D..
9802914f97
This commit is contained in:
Relintai 2023-09-03 10:50:35 +02:00
parent b4dbd26415
commit 0fb000c6a1
2 changed files with 13 additions and 1 deletions

View File

@ -2300,6 +2300,7 @@ bool Main::is_iterating() {
// For performance metrics.
static uint64_t physics_process_max = 0;
static uint64_t idle_process_max = 0;
static uint64_t navigation_process_max = 0;
#ifndef TOOLS_ENABLED
static uint64_t frame_delta_sync_time = 0;
@ -2349,6 +2350,7 @@ bool Main::iteration() {
uint64_t physics_process_ticks = 0;
uint64_t idle_process_ticks = 0;
uint64_t navigation_process_ticks = 0;
frame += ticks_elapsed;
@ -2388,7 +2390,13 @@ bool Main::iteration() {
break;
}
uint64_t navigation_begin = OS::get_singleton()->get_ticks_usec();
NavigationServer::get_singleton()->process(frame_slice * time_scale);
navigation_process_ticks = MAX(navigation_process_ticks, OS::get_singleton()->get_ticks_usec() - navigation_begin); // keep the largest one for reference
navigation_process_max = MAX(OS::get_singleton()->get_ticks_usec() - navigation_begin, navigation_process_max);
message_queue->flush();
PhysicsServer::get_singleton()->step(frame_slice * time_scale);
@ -2490,8 +2498,10 @@ bool Main::iteration() {
Engine::get_singleton()->_fps = frames;
performance->set_process_time(USEC_TO_SEC(idle_process_max));
performance->set_physics_process_time(USEC_TO_SEC(physics_process_max));
performance->set_navigation_process_time(USEC_TO_SEC(navigation_process_max));
idle_process_max = 0;
physics_process_max = 0;
navigation_process_max = 0;
frame %= 1000000;
frames = 0;

View File

@ -285,7 +285,9 @@ Performance::MonitorType Performance::get_monitor_type(Monitor p_monitor) const
MONITOR_TYPE_QUANTITY,
MONITOR_TYPE_QUANTITY,
MONITOR_TYPE_QUANTITY,
MONITOR_TYPE_QUANTITY,
MONITOR_TYPE_QUANTITY,
MONITOR_TYPE_QUANTITY,
};
return types[p_monitor];