feat: removed engine

This commit is contained in:
Sara Gerretsen 2026-06-19 16:28:48 +02:00
parent ac3bf1f22a
commit f7079927fe
13965 changed files with 0 additions and 7502068 deletions

View file

@ -1,116 +0,0 @@
#!/usr/bin/env python
from __future__ import annotations
from misc.utility.scons_hints import *
import pathlib
import profiling_builders
Import("env")
env.add_source_files(env.core_sources, "*.cpp")
default_perfetto_install_dir = "../../thirdparty/perfetto"
def find_perfetto_path(path: pathlib.Path) -> pathlib.Path:
if not path.is_dir():
print(f"Perfetto profiler path '{path.absolute()}' is invalid.")
Exit(255)
if (path / "sdk" / "perfetto.cc").is_file():
# perfetto root directory.
return path / "sdk"
if (path / "perfetto.cc").is_file():
# perfetto sdk directory.
return path
print("Invalid perfetto profiler path. Unable to find perfetto.cc.")
Exit(255)
def find_tracy_path(path: pathlib.Path) -> pathlib.Path:
if not path.is_dir():
print("profiler_path must point to a directory.")
Exit(255)
if (path / "public" / "TracyClient.cpp").is_file():
# tracy root directory
return path / "public"
if (path / "TracyClient.cpp").is_file():
# tracy public directory
return path
print("Invalid profiler_path. Unable to find TracyClient.cpp.")
Exit(255)
if env["profiler"]:
if env["profiler"] == "instruments":
if env["profiler_sample_callstack"]:
print("profiler_sample_callstack ignored. Please configure callstack sampling in Instruments instead.")
if env["profiler_track_memory"]:
print("profiler_track_memory ignored. Please configure memory tracking in Instruments instead.")
if env["profiler_record_on_demand"]:
print("profiler_record_on_demand ignored. Instruments is always recording.")
elif env["profiler"] == "tracy":
if not env["profiler_path"]:
print("profiler_path must be set when using the tracy profiler. Aborting.")
Exit(255)
profiler_path = find_tracy_path(pathlib.Path(env["profiler_path"]))
env.Prepend(CPPPATH=[str(profiler_path.absolute())])
env_tracy = env.Clone()
env_tracy.Append(CPPDEFINES=["TRACY_ENABLE"])
if env["profiler_sample_callstack"]:
if env["platform"] not in ("windows", "linuxbsd", "android"):
# Reference the feature matrix in the tracy documentation.
print("Tracy does not support call stack sampling on this platform. Aborting.")
Exit(255)
# 62 is the maximum supported callstack depth reported by the tracy docs.
env_tracy.Append(CPPDEFINES=[("TRACY_CALLSTACK", 62)])
if env["profiler_track_memory"]:
env_tracy.Append(CPPDEFINES=["GODOT_PROFILER_TRACK_MEMORY"])
if env["profiler_record_on_demand"]:
env_tracy.Append(CPPDEFINES=["TRACY_ON_DEMAND"])
env_tracy.disable_warnings()
env_tracy.add_source_files(env.core_sources, str((profiler_path / "TracyClient.cpp").absolute()))
elif env["profiler"] == "perfetto":
if env["profiler_path"]:
profiler_path = find_perfetto_path(pathlib.Path(env["profiler_path"]))
elif (default_perfetto_path := pathlib.Path(default_perfetto_install_dir)).is_dir():
profiler_path = find_perfetto_path(default_perfetto_path)
else:
print("Perfetto must be installed or profiler_path must be set when using the perfetto profiler. Aborting.")
Exit(255)
env.Prepend(CPPPATH=[str(profiler_path.absolute())])
env_perfetto = env.Clone()
if env["profiler_sample_callstack"]:
print("Perfetto does not support call stack sampling. Aborting.")
Exit(255)
if env["profiler_track_memory"]:
print("Perfetto does not support memory tracking. Aborting.")
Exit(255)
if env["profiler_record_on_demand"]:
print("profiler_record_on_demand ignored. Perfetto is always recording.")
env_perfetto.disable_warnings()
env_perfetto.Prepend(CPPPATH=[str(profiler_path.absolute())])
env_perfetto.add_source_files(env.core_sources, str((profiler_path / "perfetto.cc").absolute()))
elif env["profiler_path"]:
print("profiler is required if profiler_path is set. Aborting.")
Exit(255)
env.CommandNoCache(
"profiling.gen.h",
[
env.Value(env["profiler"]),
env.Value(env["profiler_sample_callstack"]),
env.Value(env["profiler_track_memory"]),
env.Value(env["profiler_record_on_demand"]),
],
env.Run(profiling_builders.profiler_gen_builder),
)

View file

@ -1,247 +0,0 @@
/**************************************************************************/
/* profiling.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "profiling.h"
#if defined(GODOT_USE_TRACY)
// Use the tracy profiler.
#include "core/os/mutex.h"
#include "core/templates/paged_allocator.h"
namespace tracy {
static bool configured = false;
static const char dummy_string[] = "dummy";
static tracy::SourceLocationData dummy_source_location = tracy::SourceLocationData{ dummy_string, dummy_string, dummy_string, 0, 0 };
// Implementation similar to StringName.
struct StringInternData {
StringName name;
CharString name_utf8;
uint32_t hash = 0;
StringInternData *prev = nullptr;
StringInternData *next = nullptr;
StringInternData() {}
};
struct SourceLocationInternData {
const StringInternData *file;
const StringInternData *function;
const StringInternData *name;
tracy::SourceLocationData source_location_data;
uint32_t function_ptr_hash = 0;
SourceLocationInternData *prev = nullptr;
SourceLocationInternData *next = nullptr;
SourceLocationInternData() {}
};
struct TracyInternTable {
constexpr static uint32_t TABLE_BITS = 16;
constexpr static uint32_t TABLE_LEN = 1 << TABLE_BITS;
constexpr static uint32_t TABLE_MASK = TABLE_LEN - 1;
static inline BinaryMutex mutex;
static inline SourceLocationInternData *source_location_table[TABLE_LEN];
static inline PagedAllocator<SourceLocationInternData> source_location_allocator;
static inline StringInternData *string_table[TABLE_LEN];
static inline PagedAllocator<StringInternData> string_allocator;
};
const StringInternData *_intern_name(const StringName &p_name) {
CRASH_COND(!configured);
const uint32_t hash = p_name.hash();
const uint32_t idx = hash & TracyInternTable::TABLE_MASK;
StringInternData *_data = TracyInternTable::string_table[idx];
while (_data) {
if (_data->hash == hash) {
return _data;
}
_data = _data->next;
}
_data = TracyInternTable::string_allocator.alloc();
_data->name = p_name;
_data->name_utf8 = p_name.operator String().utf8();
_data->next = TracyInternTable::string_table[idx];
_data->prev = nullptr;
if (TracyInternTable::string_table[idx]) {
TracyInternTable::string_table[idx]->prev = _data;
}
TracyInternTable::string_table[idx] = _data;
return _data;
}
const tracy::SourceLocationData *intern_source_location(const void *p_function_ptr, const StringName &p_file, const StringName &p_function, const StringName &p_name, uint32_t p_line, bool p_is_script) {
ERR_FAIL_COND_V(!configured, &dummy_source_location);
const uint32_t hash = HashMapHasherDefault::hash(p_function_ptr);
const uint32_t idx = hash & TracyInternTable::TABLE_MASK;
MutexLock lock(TracyInternTable::mutex);
SourceLocationInternData *_data = TracyInternTable::source_location_table[idx];
while (_data) {
if (_data->function_ptr_hash == hash && _data->source_location_data.line == p_line && _data->file->name == p_file && _data->function->name == p_function && _data->name->name == p_name) {
return &_data->source_location_data;
}
_data = _data->next;
}
_data = TracyInternTable::source_location_allocator.alloc();
_data->function_ptr_hash = hash;
_data->file = _intern_name(p_file);
_data->function = _intern_name(p_function);
_data->name = _intern_name(p_name);
_data->source_location_data.file = _data->file->name_utf8.get_data();
_data->source_location_data.function = _data->function->name_utf8.get_data();
_data->source_location_data.name = _data->name->name_utf8.get_data();
_data->source_location_data.line = p_line;
_data->source_location_data.color = p_is_script ? 0x478cbf : 0; // godot_logo_blue
_data->next = TracyInternTable::source_location_table[idx];
_data->prev = nullptr;
if (TracyInternTable::source_location_table[idx]) {
TracyInternTable::source_location_table[idx]->prev = _data;
}
TracyInternTable::source_location_table[idx] = _data;
return &_data->source_location_data;
}
} // namespace tracy
void godot_init_profiler() {
MutexLock lock(tracy::TracyInternTable::mutex);
ERR_FAIL_COND(tracy::configured);
for (uint32_t i = 0; i < tracy::TracyInternTable::TABLE_LEN; i++) {
tracy::TracyInternTable::source_location_table[i] = nullptr;
}
for (uint32_t i = 0; i < tracy::TracyInternTable::TABLE_LEN; i++) {
tracy::TracyInternTable::string_table[i] = nullptr;
}
tracy::configured = true;
// 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_cleanup_profiler() {
MutexLock lock(tracy::TracyInternTable::mutex);
ERR_FAIL_COND(!tracy::configured);
for (uint32_t i = 0; i < tracy::TracyInternTable::TABLE_LEN; i++) {
while (tracy::TracyInternTable::source_location_table[i]) {
tracy::SourceLocationInternData *d = tracy::TracyInternTable::source_location_table[i];
tracy::TracyInternTable::source_location_table[i] = tracy::TracyInternTable::source_location_table[i]->next;
tracy::TracyInternTable::source_location_allocator.free(d);
}
}
for (uint32_t i = 0; i < tracy::TracyInternTable::TABLE_LEN; i++) {
while (tracy::TracyInternTable::string_table[i]) {
tracy::StringInternData *d = tracy::TracyInternTable::string_table[i];
tracy::TracyInternTable::string_table[i] = tracy::TracyInternTable::string_table[i]->next;
tracy::TracyInternTable::string_allocator.free(d);
}
}
tracy::configured = false;
}
#elif defined(GODOT_USE_PERFETTO)
PERFETTO_TRACK_EVENT_STATIC_STORAGE();
void godot_init_profiler() {
perfetto::TracingInitArgs args;
args.backends |= perfetto::kSystemBackend;
perfetto::Tracing::Initialize(args);
perfetto::TrackEvent::Register();
}
void godot_cleanup_profiler() {
// Stub
}
#elif defined(GODOT_USE_INSTRUMENTS)
namespace apple::instruments {
os_log_t LOG;
os_log_t LOG_TRACING;
} // namespace apple::instruments
void godot_init_profiler() {
static bool initialized = false;
if (initialized) {
return;
}
initialized = true;
apple::instruments::LOG = os_log_create("org.godotengine.godot", OS_LOG_CATEGORY_POINTS_OF_INTEREST);
#ifdef INSTRUMENTS_SAMPLE_CALLSTACKS
apple::instruments::LOG_TRACING = os_log_create("org.godotengine.godot", OS_LOG_CATEGORY_DYNAMIC_STACK_TRACING);
#else
apple::instruments::LOG_TRACING = os_log_create("org.godotengine.godot", "tracing");
#endif
}
void godot_cleanup_profiler() {
}
#else
void godot_init_profiler() {
// Stub
}
void godot_cleanup_profiler() {
// Stub
}
#endif

View file

@ -1,270 +0,0 @@
/**************************************************************************/
/* profiling.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#pragma once
#include "profiling.gen.h" // IWYU pragma: keep.
// This header provides profiling primitives (implemented as macros) for various backends.
// See the "No profiling" branch at the bottom for a short description of the functions.
// To configure / use the profiler, use the --profiler_path and other --profiler_* arguments
// when compiling Godot. You can also find details in the SCSub file (in this folder).
// Note: It is highly recommended to avoid including this header in other header files.
// Prefer including it in .cpp files only. The reason is that we want to keep
// the recompile cost of changing the profiler as low as possible.
#if defined(GODOT_USE_TRACY)
// Use the tracy profiler.
#include "core/string/string_name.h"
#define TRACY_ENABLE
#include <tracy/Tracy.hpp>
// Hijacking the tracy namespace so we can use their macros.
namespace tracy {
const SourceLocationData *intern_source_location(const void *p_function_ptr, const StringName &p_file, const StringName &p_function, const StringName &p_name, uint32_t p_line, bool p_is_script);
} //namespace tracy
// Define tracing macros.
#define GodotProfileFrameMark FrameMark
#define GodotProfileZone(m_zone_name) ZoneNamedN(GD_UNIQUE_NAME(__godot_tracy_szone_), m_zone_name, true)
#define GodotProfileZoneGroupedFirst(m_group_name, m_zone_name) ZoneNamedN(__godot_tracy_zone_##m_group_name, m_zone_name, true)
#define GodotProfileZoneGroupedEndEarly(m_group_name, m_zone_name) __godot_tracy_zone_##m_group_name.~ScopedZone();
#ifndef TRACY_CALLSTACK
#define GodotProfileZoneGrouped(m_group_name, m_zone_name) \
GodotProfileZoneGroupedEndEarly(m_group_name, m_zone_name); \
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), true)
#else
#define GodotProfileZoneGrouped(m_group_name, m_zone_name) \
GodotProfileZoneGroupedEndEarly(m_group_name, m_zone_name); \
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)
#endif
#define GodotProfileZoneScript(m_ptr, m_file, m_function, m_name, m_line) \
tracy::ScopedZone __godot_tracy_script(tracy::intern_source_location(m_ptr, m_file, m_function, m_name, m_line, true))
#define GodotProfileZoneScriptSystemCall(m_ptr, m_file, m_function, m_name, m_line) \
tracy::ScopedZone __godot_tracy_zone_system_call(tracy::intern_source_location(m_ptr, m_file, m_function, m_name, m_line, false))
// Memory allocation
#ifdef GODOT_PROFILER_TRACK_MEMORY
#define GodotProfileAlloc(m_ptr, m_size) \
GODOT_GCC_WARNING_PUSH_AND_IGNORE("-Wmaybe-uninitialized") \
TracyAlloc(m_ptr, m_size); \
GODOT_GCC_WARNING_POP
#define GodotProfileFree(m_ptr) TracyFree(m_ptr)
#else
#define GodotProfileAlloc(m_ptr, m_size)
#define GodotProfileFree(m_ptr)
#endif
void godot_init_profiler();
void godot_cleanup_profiler();
#elif defined(GODOT_USE_PERFETTO)
// Use the perfetto profiler.
#include "core/typedefs.h"
#include "main/performance.h"
#include <perfetto.h>
PERFETTO_DEFINE_CATEGORIES(
perfetto::Category("godot")
.SetDescription("Godot Engine Events"),
perfetto::Category("godot_scripting")
.SetDescription("Godot Scripting Events"), );
// See PERFETTO_INTERNAL_SCOPED_EVENT_FINALIZER
struct PerfettoGroupedEventEnder {
_FORCE_INLINE_ void _end_now() {
TRACE_EVENT_END("godot");
}
_FORCE_INLINE_ ~PerfettoGroupedEventEnder() {
_end_now();
}
};
#define GodotProfileFrameMark \
perfetto::CounterTrack __frame_time_track = perfetto::CounterTrack("Frame time", "ms").set_unit_multiplier(1000); \
TRACE_COUNTER("godot", __frame_time_track, Performance::get_singleton()->get_monitor(Performance::Monitor::TIME_PROCESS));
#define GodotProfileZone(m_zone_name) TRACE_EVENT("godot", m_zone_name);
#define GodotProfileZoneGroupedFirst(m_group_name, m_zone_name) \
TRACE_EVENT_BEGIN("godot", m_zone_name); \
PerfettoGroupedEventEnder __godot_perfetto_zone_##m_group_name
#define GodotProfileZoneGroupedEndEarly(m_group_name, m_zone_name) __godot_perfetto_zone_##m_group_name.~PerfettoGroupedEventEnder()
#define GodotProfileZoneGrouped(m_group_name, m_zone_name) \
__godot_perfetto_zone_##m_group_name._end_now(); \
TRACE_EVENT_BEGIN("godot", m_zone_name);
static HashSet<StringName> __tracing_system_call;
/**
* Script tracing may cross function boundaries (tracing started in the caller script), so the logic below only triggers
* a TRACE_EVENT_BEGIN for `GodotProfileZoneScript` if tracing hasn't already been initiated by
* `GodotProfileZoneScriptSystemCall` in the caller.
*/
struct PerfettoScriptTracer {
StringName name;
bool is_system_call;
bool tracing;
PerfettoScriptTracer(const StringName &p_file, const StringName &p_function, const StringName &p_name, int p_line, bool p_system_call) : name(p_name), is_system_call(p_system_call) {
if (is_system_call || !__tracing_system_call.erase(name)) {
TRACE_EVENT_BEGIN("godot_scripting", perfetto::DynamicString(p_name.operator String().utf8().get_data()), "source file", p_file.operator String().utf8().get_data(), "line number", p_line);
tracing = true;
}
if (is_system_call) {
__tracing_system_call.insert(name);
}
}
_FORCE_INLINE_ void _end_now() {
if (tracing) {
TRACE_EVENT_END("godot_scripting");
}
}
_FORCE_INLINE_ ~PerfettoScriptTracer() {
_end_now();
if (is_system_call) {
__tracing_system_call.erase(name);
}
}
};
#define GodotProfileZoneScript(m_ptr, m_file, m_function, m_name, m_line) PerfettoScriptTracer __godot_perfetto_script_tracer(m_file, m_function, m_name, m_line, false);
#define GodotProfileZoneScriptSystemCall(m_ptr, m_file, m_function, m_name, m_line) PerfettoScriptTracer __godot_perfetto_script_system_call_tracer(m_file, m_function, m_name, m_line, true);
#define GodotProfileAlloc(m_ptr, m_size)
#define GodotProfileFree(m_ptr)
void godot_init_profiler();
void godot_cleanup_profiler();
#elif defined(GODOT_USE_INSTRUMENTS)
#include <os/log.h>
#include <os/signpost.h>
namespace apple::instruments {
extern os_log_t LOG;
extern os_log_t LOG_TRACING;
typedef void (*DeferFunc)();
class Defer {
public:
explicit Defer(DeferFunc p_fn) :
_fn(p_fn) {}
~Defer() {
_fn();
}
private:
DeferFunc _fn;
};
} // namespace apple::instruments
#define GodotProfileFrameMark \
os_signpost_event_emit(apple::instruments::LOG, OS_SIGNPOST_ID_EXCLUSIVE, "Frame");
#define GodotProfileZoneGroupedFirst(m_group_name, m_zone_name) \
os_signpost_interval_begin(apple::instruments::LOG_TRACING, OS_SIGNPOST_ID_EXCLUSIVE, m_zone_name); \
apple::instruments::DeferFunc _GD_VARNAME_CONCAT_(defer__fn, _, m_group_name) = []() { \
os_signpost_interval_end(apple::instruments::LOG_TRACING, OS_SIGNPOST_ID_EXCLUSIVE, m_zone_name); \
}; \
apple::instruments::Defer _GD_VARNAME_CONCAT_(__instruments_defer_zone_end__, _, m_group_name)(_GD_VARNAME_CONCAT_(defer__fn, _, m_group_name));
#define GodotProfileZoneGroupedEndEarly(m_group_name, m_zone_name) \
_GD_VARNAME_CONCAT_(__instruments_defer_zone_end__, _, m_group_name).~Defer();
#define GodotProfileZoneGrouped(m_group_name, m_zone_name) \
GodotProfileZoneGroupedEndEarly(m_group_name, m_zone_name); \
os_signpost_interval_begin(apple::instruments::LOG_TRACING, OS_SIGNPOST_ID_EXCLUSIVE, m_zone_name); \
_GD_VARNAME_CONCAT_(defer__fn, _, m_group_name) = []() { \
os_signpost_interval_end(apple::instruments::LOG_TRACING, OS_SIGNPOST_ID_EXCLUSIVE, m_zone_name); \
}; \
new (&_GD_VARNAME_CONCAT_(__instruments_defer_zone_end__, _, m_group_name)) apple::instruments::Defer(_GD_VARNAME_CONCAT_(defer__fn, _, m_group_name));
#define GodotProfileZone(m_zone_name) \
GodotProfileZoneGroupedFirst(__COUNTER__, m_zone_name)
#define GodotProfileZoneScript(m_ptr, m_file, m_function, m_name, m_line)
#define GodotProfileZoneScriptSystemCall(m_ptr, m_file, m_function, m_name, m_line)
// Instruments has its own memory profiling, so these are no-ops.
#define GodotProfileAlloc(m_ptr, m_size)
#define GodotProfileFree(m_ptr)
void godot_init_profiler();
void godot_cleanup_profiler();
#else
// No profiling; all macros are stubs.
void godot_init_profiler();
void godot_cleanup_profiler();
// Tell the profiling backend that a new frame has started.
#define GodotProfileFrameMark
// Defines a profile zone from here to the end of the scope.
#define GodotProfileZone(m_zone_name)
// Defines a profile zone group. The first profile zone starts immediately,
// and ends either when the next zone starts, or when the scope ends.
#define GodotProfileZoneGroupedFirst(m_group_name, m_zone_name)
// End the profile zone group's current profile zone now.
#define GodotProfileZoneGroupedEndEarly(m_group_name, m_zone_name)
// Replace the profile zone group's current profile zone.
// The new zone ends either when the next zone starts, or when the scope ends.
#define GodotProfileZoneGrouped(m_group_name, m_zone_name)
// Tell the profiling backend that an allocation happened, with its location and size.
#define GodotProfileAlloc(m_ptr, m_size)
// Tell the profiling backend that an allocation was freed.
// There must be a one to one correspondence of GodotProfileAlloc and GodotProfileFree calls.
#define GodotProfileFree(m_ptr)
// Define a zone for a script call (dynamic source location).
// m_ptr is a pointer to the function instance, which will be used for the lookup.
// m_file, m_function, m_name are StringNames, and m_line is uint32_t
#define GodotProfileZoneScript(m_ptr, m_file, m_function, m_name, m_line)
// Define a zone for a system call from a script (dynamic source location).
#define GodotProfileZoneScriptSystemCall(m_ptr, m_file, m_function, m_name, m_line)
#endif

View file

@ -1,21 +0,0 @@
"""Functions used to generate source files during build time"""
import methods
def profiler_gen_builder(target, source, env):
with methods.generated_wrapper(str(target[0])) as file:
if env["profiler"] == "tracy":
file.write("#define GODOT_USE_TRACY\n")
if env["profiler_sample_callstack"]:
file.write("#define TRACY_CALLSTACK 62\n")
if env["profiler_track_memory"]:
file.write("#define GODOT_PROFILER_TRACK_MEMORY\n")
if env["profiler_record_on_demand"]:
file.write("#define TRACY_ON_DEMAND\n")
if env["profiler"] == "perfetto":
file.write("#define GODOT_USE_PERFETTO\n")
if env["profiler"] == "instruments":
file.write("#define GODOT_USE_INSTRUMENTS\n")
if env["profiler_sample_callstack"]:
file.write("#define INSTRUMENTS_SAMPLE_CALLSTACKS\n")