From b8ddaf9c33107e01928e04ed462aa08d4017247b Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Thu, 27 Feb 2020 03:30:20 +0100 Subject: Refactor ScriptDebugger. EngineDebugger is the new interface to access the debugger. It tries to be as agnostic as possible on the data that various subsystems can expose. It allows 2 types of interactions: - Profilers: A subsystem can register a profiler, assigning it a unique name. That name can be used to activate the profiler or add data to it. The registered profiler can be composed of up to 3 functions: - Toggle: called when the profiler is activated/deactivated. - Add: called whenever data is added to the debugger (via `EngineDebugger::profiler_add_frame_data`) - Tick: called every frame (during idle), receives frame times. - Captures: (Only relevant in remote debugger for now) A subsystem can register a capture, assigning it a unique name. When receiving a message, the remote debugger will check if it starts with `[prefix]:` and call the associated capture with name `prefix`. Port MultiplayerAPI, Servers, Scripts, Visual, Performance to the new profiler system. Port SceneDebugger and RemoteDebugger to the new capture system. The LocalDebugger also uses the new profiler system for scripts profiling. --- servers/physics_2d/physics_2d_server_sw.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'servers/physics_2d') diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index aa374aa6bc..baeb3f76b0 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -32,9 +32,9 @@ #include "broad_phase_2d_basic.h" #include "broad_phase_2d_hash_grid.h" #include "collision_solver_2d_sw.h" +#include "core/debugger/engine_debugger.h" #include "core/os/os.h" #include "core/project_settings.h" -#include "core/script_language.h" #define FLUSH_QUERY_CHECK(m_object) \ ERR_FAIL_COND_MSG(m_object->get_space() && flushing_queries, "Can't change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead."); @@ -1369,7 +1369,7 @@ void Physics2DServerSW::flush_queries() { flushing_queries = false; - if (ScriptDebugger::get_singleton() && ScriptDebugger::get_singleton()->is_profiling()) { + if (EngineDebugger::is_profiling("servers")) { uint64_t total_time[Space2DSW::ELAPSED_TIME_MAX]; static const char *time_name[Space2DSW::ELAPSED_TIME_MAX] = { @@ -1400,7 +1400,8 @@ void Physics2DServerSW::flush_queries() { values.push_back("flush_queries"); values.push_back(USEC_TO_SEC(OS::get_singleton()->get_ticks_usec() - time_beg)); - ScriptDebugger::get_singleton()->add_profiling_frame_data("physics_2d", values); + values.push_front("physics_2d"); + EngineDebugger::profiler_add_frame_data("servers", values); } } -- cgit v1.2.3