diff options
Diffstat (limited to 'scene/debugger/script_debugger_remote.cpp')
-rw-r--r-- | scene/debugger/script_debugger_remote.cpp | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/scene/debugger/script_debugger_remote.cpp b/scene/debugger/script_debugger_remote.cpp index 04d04ceb66..0e61a5746b 100644 --- a/scene/debugger/script_debugger_remote.cpp +++ b/scene/debugger/script_debugger_remote.cpp @@ -92,7 +92,7 @@ Error ScriptDebuggerRemote::connect_to_host(const String &p_host, uint16_t p_por if (tcp_client->get_status() != StreamPeerTCP::STATUS_CONNECTED) { - ERR_PRINTS("Remote Debugger: Unable to connect. Status: " + String::num(tcp_client->get_status()) + "."); + ERR_PRINT("Remote Debugger: Unable to connect. Status: " + String::num(tcp_client->get_status()) + "."); return FAILED; }; @@ -106,7 +106,7 @@ void ScriptDebuggerRemote::_put_variable(const String &p_name, const Variant &p_ packet_peer_stream->put_var(p_name); Variant var = p_variable; - if (p_variable.get_type() == Variant::OBJECT && !ObjectDB::instance_validate(p_variable)) { + if (p_variable.get_type() == Variant::OBJECT && p_variable.get_validated_object() == nullptr) { var = Variant(); } @@ -805,14 +805,22 @@ void ScriptDebuggerRemote::_poll_events() { profiling = false; _send_profiling_data(false); print_line("PROFILING END!"); + } else if (command == "start_visual_profiling") { + + visual_profiling = true; + VS::get_singleton()->set_frame_profiling_enabled(true); + } else if (command == "stop_visual_profiling") { + + visual_profiling = false; + VS::get_singleton()->set_frame_profiling_enabled(false); } else if (command == "start_network_profiling") { + network_profiling = true; multiplayer->profiling_start(); - profiling_network = true; } else if (command == "stop_network_profiling") { + network_profiling = false; multiplayer->profiling_end(); - profiling_network = false; } else if (command == "override_camera_2D:set") { bool enforce = cmd[1]; @@ -985,6 +993,30 @@ void ScriptDebuggerRemote::idle_poll() { packet_peer_stream->put_var(arr); } } + if (visual_profiling) { + Vector<VS::FrameProfileArea> profile_areas = VS::get_singleton()->get_frame_profile(); + if (profile_areas.size()) { + Vector<String> area_names; + Vector<real_t> area_times; + area_names.resize(profile_areas.size()); + area_times.resize(profile_areas.size() * 2); + { + String *area_namesw = area_names.ptrw(); + real_t *area_timesw = area_times.ptrw(); + + for (int i = 0; i < profile_areas.size(); i++) { + area_namesw[i] = profile_areas[i].name; + area_timesw[i * 2 + 0] = profile_areas[i].cpu_msec; + area_timesw[i * 2 + 1] = profile_areas[i].gpu_msec; + } + } + packet_peer_stream->put_var("visual_profile"); + packet_peer_stream->put_var(3); + packet_peer_stream->put_var(VS::get_singleton()->get_frame_profile_frame()); + packet_peer_stream->put_var(area_names); + packet_peer_stream->put_var(area_times); + } + } if (profiling) { @@ -996,7 +1028,7 @@ void ScriptDebuggerRemote::idle_poll() { } } - if (profiling_network) { + if (network_profiling) { uint64_t pt = OS::get_singleton()->get_ticks_msec(); if (pt - last_net_bandwidth_time > 200) { last_net_bandwidth_time = pt; @@ -1229,7 +1261,8 @@ ScriptDebuggerRemote::ResourceUsageFunc ScriptDebuggerRemote::resource_usage_fun ScriptDebuggerRemote::ScriptDebuggerRemote() : profiling(false), - profiling_network(false), + visual_profiling(false), + network_profiling(false), max_frame_functions(16), skip_profile_frame(false), reload_all_scripts(false), |