mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Add some important profiling hooks.
This commit is contained in:
parent
e80194e31f
commit
c3747884da
14 changed files with 118 additions and 10 deletions
|
|
@ -30,7 +30,13 @@
|
|||
|
||||
#include "profiling.h"
|
||||
|
||||
#ifdef GODOT_USE_PERFETTO
|
||||
#if defined(GODOT_USE_TRACY)
|
||||
void godot_init_profiler() {
|
||||
// Send our first event to tracy; otherwise it doesn't start collecting data.
|
||||
// FrameMark is kind of fitting because it communicates "this is where we started tracing".
|
||||
FrameMark;
|
||||
}
|
||||
#elif defined(GODOT_USE_PERFETTO)
|
||||
PERFETTO_TRACK_EVENT_STATIC_STORAGE();
|
||||
|
||||
void godot_init_profiler() {
|
||||
|
|
@ -41,5 +47,8 @@ void godot_init_profiler() {
|
|||
perfetto::Tracing::Initialize(args);
|
||||
perfetto::TrackEvent::Register();
|
||||
}
|
||||
|
||||
#else
|
||||
void godot_init_profiler() {
|
||||
// Stub
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -53,11 +53,7 @@
|
|||
static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location, TracyLine){ m_zone_name, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; \
|
||||
new (&__godot_tracy_zone_##m_group_name) tracy::ScopedZone(&TracyConcat(__tracy_source_location, TracyLine), TRACY_CALLSTACK, true)
|
||||
|
||||
static void godot_init_profiler() {
|
||||
// Send our first event to tracy; otherwise it doesn't start collecting data.
|
||||
// FrameMark is kind of fitting because it communicates "this is where we started tracing".
|
||||
FrameMark;
|
||||
}
|
||||
void godot_init_profiler();
|
||||
|
||||
#elif defined(GODOT_USE_PERFETTO)
|
||||
// Use the perfetto profiler.
|
||||
|
|
@ -94,8 +90,7 @@ void godot_init_profiler();
|
|||
#else
|
||||
// No profiling; all macros are stubs.
|
||||
|
||||
static void godot_init_profiler() {
|
||||
}
|
||||
void godot_init_profiler();
|
||||
|
||||
#define GodotProfileFrameMark
|
||||
#define GodotProfileZone(m_zone_name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue