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.
This commit is contained in:
parent
d0009636df
commit
b8ddaf9c33
48 changed files with 2748 additions and 2316 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue