From c4ec279121cbc9a0ce23081d5f0cdcf037bd1d04 Mon Sep 17 00:00:00 2001 From: Imbris Date: Fri, 30 Jul 2021 01:01:17 -0400 Subject: [PATCH] Add feature to profile memory allocation with Tracy --- voxygen/Cargo.toml | 1 + voxygen/src/main.rs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index c7504d5890..6ded232b41 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -28,6 +28,7 @@ hot-reloading = ["common/hot-reloading"] singleplayer = ["server"] simd = ["vek/platform_intrinsics"] tracy = ["profiling", "profiling/profile-with-tracy", "common-frontend/tracy", "client/tracy"] +tracy-memory = ["tracy"] # enables heap profiling with tracy plugins = ["client/plugins"] egui-ui = ["voxygen-egui", "egui", "egui_wgpu_backend", "egui_winit_platform"] diff --git a/voxygen/src/main.rs b/voxygen/src/main.rs index f7dff8f1c7..a668bd44df 100644 --- a/voxygen/src/main.rs +++ b/voxygen/src/main.rs @@ -2,6 +2,12 @@ #![feature(bool_to_option)] #![recursion_limit = "2048"] +// Allow profiling allocations with Tracy +#[cfg_attr(feature = "tracy-memory", global_allocator)] +#[cfg(feature = "tracy-memory")] +static GLOBAL: common_base::tracy_client::ProfiledAllocator = + common_base::tracy_client::ProfiledAllocator::new(std::alloc::System, 128); + use i18n::{self, LocalizationHandle}; use veloren_voxygen::{ audio::AudioFrontend,