Add support for profiling using tracy

This commit is contained in:
Ian Douglas Scott 2023-10-07 19:15:44 -07:00 committed by Victoria Brekenfeld
parent 929f4fcb05
commit a1c8b3aa3e
18 changed files with 122 additions and 5 deletions

View file

@ -38,6 +38,11 @@ pub mod utils;
pub mod wayland;
pub mod xwayland;
#[cfg(feature = "profile-with-tracy")]
#[global_allocator]
static GLOBAL: profiling::tracy_client::ProfiledAllocator<std::alloc::System> =
profiling::tracy_client::ProfiledAllocator::new(std::alloc::System, 10);
fn main() -> Result<()> {
// setup logger
logger::init_logger()?;
@ -80,6 +85,11 @@ fn main() -> Result<()> {
warn!(?err, "Failed to watch theme");
}
#[cfg(feature = "profile-with-tracy")]
profiling::tracy_client::Client::start();
profiling::register_thread!("Main Thread");
// run the event loop
event_loop.run(None, &mut state, |state| {
// shall we shut down?