Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a feature for memory tracing with tracy #8272

Merged
merged 1 commit into from Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Expand Up @@ -108,6 +108,9 @@ trace_chrome = ["trace", "bevy_internal/trace_chrome"]
# Tracing support, exposing a port for Tracy
trace_tracy = ["trace", "bevy_internal/trace_tracy"]

# Tracing support, with memory profiling, exposing a port for Tracy
trace_tracy_memory = ["trace", "bevy_internal/trace_tracy", "bevy_internal/trace_tracy_memory"]

# Tracing support
trace = ["bevy_internal/trace"]

Expand Down
1 change: 1 addition & 0 deletions crates/bevy_internal/Cargo.toml
Expand Up @@ -21,6 +21,7 @@ trace = [
]
trace_chrome = [ "bevy_log/tracing-chrome" ]
trace_tracy = ["bevy_render?/tracing-tracy", "bevy_log/tracing-tracy" ]
trace_tracy_memory = ["bevy_log/trace_tracy_memory"]
wgpu_trace = ["bevy_render/wgpu_trace"]
debug_asset_server = ["bevy_asset/debug_asset_server"]
detailed_trace = ["bevy_utils/detailed_trace"]
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_log/Cargo.toml
Expand Up @@ -10,6 +10,7 @@ keywords = ["bevy"]

[features]
trace = [ "tracing-error" ]
trace_tracy_memory = ["dep:tracy-client"]

[dependencies]
bevy_app = { path = "../bevy_app", version = "0.11.0-dev" }
Expand All @@ -21,6 +22,7 @@ tracing-chrome = { version = "0.7.0", optional = true }
tracing-tracy = { version = "0.10.0", optional = true }
tracing-log = "0.1.2"
tracing-error = { version = "0.2.0", optional = true }
tracy-client = { version = "0.15", optional = true }

[target.'cfg(target_os = "android")'.dependencies]
android_log-sys = "0.2.0"
Expand Down
5 changes: 5 additions & 0 deletions crates/bevy_log/src/lib.rs
Expand Up @@ -17,6 +17,11 @@ use std::panic;
#[cfg(target_os = "android")]
mod android_tracing;

#[cfg(feature = "trace_tracy_memory")]
#[global_allocator]
static GLOBAL: tracy_client::ProfiledAllocator<std::alloc::System> =
tracy_client::ProfiledAllocator::new(std::alloc::System, 100);

pub mod prelude {
//! The Bevy Log Prelude.
#[doc(hidden)]
Expand Down
1 change: 1 addition & 0 deletions docs/cargo_features.md
Expand Up @@ -67,6 +67,7 @@ The default feature set enables most of the expected features of a game engine,
|trace|Tracing support|
|trace_chrome|Tracing support, saving a file in Chrome Tracing format|
|trace_tracy|Tracing support, exposing a port for Tracy|
|trace_tracy_memory|Tracing support, with memory profiling, exposing a port for Tracy|
|wav|WAV audio format support|
|wayland|Wayland display server support|
|webp|WebP image format support|
Expand Down