diff --git a/.gitignore b/.gitignore index 1b52c1b..762885d 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ target/ #old source _src + +_visualizer.json diff --git a/Cargo.lock b/Cargo.lock index 8a4cca4..74b146e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -771,6 +771,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ "ahash 0.7.6", + "serde", ] [[package]] @@ -897,6 +898,12 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "itoa" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" + [[package]] name = "jni-sys" version = "0.3.0" @@ -935,6 +942,7 @@ dependencies = [ "nohash-hasher", "postcard", "rayon", + "serde_json", "shipyard", "strum", "uflow", @@ -1611,6 +1619,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "ryu" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" + [[package]] name = "safe_arch" version = "0.5.2" @@ -1670,6 +1684,17 @@ dependencies = [ "syn", ] +[[package]] +name = "serde_json" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" +dependencies = [ + "itoa", + "ryu", + "serde", +] + [[package]] name = "serde_spanned" version = "0.6.1" @@ -1718,6 +1743,7 @@ dependencies = [ "hashbrown 0.12.3", "lock_api", "rayon", + "serde", "shipyard_proc", ] diff --git a/kubi/Cargo.toml b/kubi/Cargo.toml index f2ca9d0..b761204 100644 --- a/kubi/Cargo.toml +++ b/kubi/Cargo.toml @@ -21,11 +21,13 @@ flume = "0.10" gilrs = { version = "0.10", default_features = false, features = ["xinput"] } uflow = "0.7" postcard = { version = "1.0", features = ["alloc"] } +serde_json = { version = "1.0", optional = true } [target.'cfg(target_os = "windows")'.dependencies] winapi = { version = "0.3" } [features] default = [] +generate_visualizer_data = ["serde_json", "shipyard/serde1"] parallel = ["shipyard/parallel"] nightly = ["glam/core-simd", "kubi-shared/nightly"] diff --git a/kubi/src/main.rs b/kubi/src/main.rs index 4ed6b8b..8f071fc 100644 --- a/kubi/src/main.rs +++ b/kubi/src/main.rs @@ -187,6 +187,13 @@ fn main() { world.add_workload(render); world.add_workload(after_frame_end); + //Save _visualizer.json + #[cfg(feature = "generate_visualizer_data")] + std::fs::write( + "_visualizer.json", + serde_json::to_string(&world.workloads_type_usage()).unwrap(), + ).unwrap(); + //Run startup systems world.run_workload(startup).unwrap();