From 0fb000c6a17a2a9f12acd7d19cdb5a5776cc299b Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 3 Sep 2023 10:50:35 +0200 Subject: [PATCH] Added in missing changes from Add NavigationServer Performance Monitor Adds Performance Monitor for NavigationServer3D.. https://github.com/godotengine/godot/commit/9802914f9793b6888cc70e3d7f0d815bdd5188bb --- main/main.cpp | 10 ++++++++++ main/performance.cpp | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/main/main.cpp b/main/main.cpp index 41b4be360..75bc1d17e 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -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; diff --git a/main/performance.cpp b/main/performance.cpp index 52b826ed1..5590315a2 100644 --- a/main/performance.cpp +++ b/main/performance.cpp @@ -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];