diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-03-09 19:08:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-09 19:08:07 +0100 |
commit | 478337c412f767b908820d7bb56c786bf0b909cb (patch) | |
tree | 019ee1871f24bed0b9c56391830a48583dd15a54 /servers | |
parent | 640169da5b20538c2d5c1106957461a3c988e2bc (diff) | |
parent | 3b47eb51e4025fae6dd63eb405dee54c49281a5f (diff) |
Merge pull request #36751 from Faless/debugger/threads_and_profilers
ScriptDebugger refactor, threading, profilers.
Diffstat (limited to 'servers')
-rw-r--r-- | servers/audio_server.cpp | 6 | ||||
-rw-r--r-- | servers/physics/physics_server_sw.cpp | 7 | ||||
-rw-r--r-- | servers/physics_2d/physics_2d_server_sw.cpp | 7 | ||||
-rw-r--r-- | servers/register_server_types.cpp | 24 |
4 files changed, 12 insertions, 32 deletions
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index caee5f5db5..0e68c8a543 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -30,6 +30,7 @@ #include "audio_server.h" +#include "core/debugger/engine_debugger.h" #include "core/io/resource_loader.h" #include "core/os/file_access.h" #include "core/os/os.h" @@ -992,7 +993,7 @@ void AudioServer::init() { void AudioServer::update() { #ifdef DEBUG_ENABLED - if (ScriptDebugger::get_singleton() && ScriptDebugger::get_singleton()->is_profiling()) { + if (EngineDebugger::is_profiling("servers")) { // Driver time includes server time + effects times // Server time includes effects times @@ -1030,7 +1031,8 @@ void AudioServer::update() { values.push_back("audio_driver"); values.push_back(USEC_TO_SEC(driver_time)); - ScriptDebugger::get_singleton()->add_profiling_frame_data("audio_thread", values); + values.push_front("audio_thread"); + EngineDebugger::profiler_add_frame_data("servers", values); } // Reset profiling times diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp index 6024e9ab7f..25b21a5394 100644 --- a/servers/physics/physics_server_sw.cpp +++ b/servers/physics/physics_server_sw.cpp @@ -32,8 +32,8 @@ #include "broad_phase_basic.h" #include "broad_phase_octree.h" +#include "core/debugger/engine_debugger.h" #include "core/os/os.h" -#include "core/script_language.h" #include "joints/cone_twist_joint_sw.h" #include "joints/generic_6dof_joint_sw.h" #include "joints/hinge_joint_sw.h" @@ -1467,7 +1467,7 @@ void PhysicsServerSW::flush_queries() { flushing_queries = false; - if (ScriptDebugger::get_singleton() && ScriptDebugger::get_singleton()->is_profiling()) { + if (EngineDebugger::is_profiling("servers")) { uint64_t total_time[SpaceSW::ELAPSED_TIME_MAX]; static const char *time_name[SpaceSW::ELAPSED_TIME_MAX] = { @@ -1498,7 +1498,8 @@ void PhysicsServerSW::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", values); + values.push_front("physics"); + EngineDebugger::profiler_add_frame_data("server", values); } #endif }; 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); } } diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp index c9f5277a4d..fd65f57380 100644 --- a/servers/register_server_types.cpp +++ b/servers/register_server_types.cpp @@ -56,7 +56,6 @@ #include "audio_server.h" #include "camera/camera_feed.h" #include "camera_server.h" -#include "core/script_debugger_remote.h" #include "navigation_2d_server.h" #include "navigation_server.h" #include "physics/physics_server_sw.h" @@ -67,27 +66,6 @@ #include "visual/shader_types.h" #include "visual_server.h" -static void _debugger_get_resource_usage(ScriptDebuggerRemote::ResourceUsage *r_usage) { - - List<VS::TextureInfo> tinfo; - VS::get_singleton()->texture_debug_usage(&tinfo); - - for (List<VS::TextureInfo>::Element *E = tinfo.front(); E; E = E->next()) { - - ScriptDebuggerRemote::ResourceInfo usage; - usage.path = E->get().path; - usage.vram = E->get().bytes; - usage.id = E->get().texture; - usage.type = "Texture"; - if (E->get().depth == 0) { - usage.format = itos(E->get().width) + "x" + itos(E->get().height) + " " + Image::get_format_name(E->get().format); - } else { - usage.format = itos(E->get().width) + "x" + itos(E->get().height) + "x" + itos(E->get().depth) + " " + Image::get_format_name(E->get().format); - } - r_usage->infos.push_back(usage); - } -} - ShaderTypes *shader_types = NULL; PhysicsServer *_createGodotPhysicsCallback() { @@ -189,8 +167,6 @@ void register_server_types() { ClassDB::register_virtual_class<PhysicsDirectSpaceState>(); ClassDB::register_virtual_class<PhysicsShapeQueryResult>(); - ScriptDebuggerRemote::resource_usage_func = _debugger_get_resource_usage; - // Physics 2D GLOBAL_DEF(Physics2DServerManager::setting_property_name, "DEFAULT"); ProjectSettings::get_singleton()->set_custom_property_info(Physics2DServerManager::setting_property_name, PropertyInfo(Variant::STRING, Physics2DServerManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT")); |