From fd31d0cd99e93d5b859952ad176d5aa79868e5e6 Mon Sep 17 00:00:00 2001 From: Nova Date: Sat, 14 Jan 2023 10:38:39 -0500 Subject: [PATCH] feat(tokio): profiling --- .cargo/config.toml | 2 ++ Cargo.toml | 5 +++++ src/main.rs | 6 +++++- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..16f1e73 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +rustflags = ["--cfg", "tokio_unstable"] \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 7b93b2d..f71d6fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,9 +51,14 @@ features = ["desktop", "renderer_gl", "wayland_frontend"] version = "*" optional = true +[dependencies.console-subscriber] +version = "0.1.8" +optional = true + [features] default = ["wayland"] wayland = ["dep:smithay", "dep:xkbcommon"] +profile = ["dep:console-subscriber"] # [patch.crates-io.stereokit] # path = "../stereokit-rs" diff --git a/src/main.rs b/src/main.rs index da54089..77d7948 100644 --- a/src/main.rs +++ b/src/main.rs @@ -42,7 +42,11 @@ struct CliArgs { } fn main() -> Result<()> { - tracing_subscriber::fmt::init(); + if !cfg!(feature = "profile") { + tracing_subscriber::fmt::init(); + } + #[cfg(feature = "profile")] + console_subscriber::init(); let project_dirs = ProjectDirs::from("", "", "stardust").unwrap(); let cli_args = Arc::new(CliArgs::parse());