diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2023-01-12 10:36:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-12 10:36:18 +0100 |
commit | a5dedfe2609f22bbf497efd1ef457ba8487ce7c8 (patch) | |
tree | 7dc3f32261d73da5efc94c10505dbd625b5b32ba /main/main.cpp | |
parent | 0e4e782ada0bdd4ef19415f82a6373e2d79f7ecc (diff) | |
parent | 9802914f9793b6888cc70e3d7f0d815bdd5188bb (diff) |
Merge pull request #70731 from smix8/navigationserver_performance_monitor_4.x
Add NavigationServer Performance Monitor
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp index 190cdf3151..5736aedfe5 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -2964,6 +2964,7 @@ bool Main::is_iterating() { // For performance metrics. static uint64_t physics_process_max = 0; static uint64_t process_max = 0; +static uint64_t navigation_process_max = 0; bool Main::iteration() { //for now do not error on this @@ -2992,6 +2993,7 @@ bool Main::iteration() { uint64_t physics_process_ticks = 0; uint64_t process_ticks = 0; + uint64_t navigation_process_ticks = 0; frame += ticks_elapsed; @@ -3029,6 +3031,12 @@ bool Main::iteration() { } NavigationServer3D::get_singleton()->process(physics_step * time_scale); + uint64_t navigation_begin = OS::get_singleton()->get_ticks_usec(); + + NavigationServer3D::get_singleton()->process(physics_step * 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(); @@ -3108,8 +3116,10 @@ bool Main::iteration() { Engine::get_singleton()->_fps = frames; performance->set_process_time(USEC_TO_SEC(process_max)); performance->set_physics_process_time(USEC_TO_SEC(physics_process_max)); + performance->set_navigation_process_time(USEC_TO_SEC(navigation_process_max)); process_max = 0; physics_process_max = 0; + navigation_process_max = 0; frame %= 1000000; frames = 0; |