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:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user