add generate_visualizer_data feature

This commit is contained in:
griffi-gh 2023-03-09 00:56:46 +01:00
parent 09b0a0160b
commit 7bc81fc72a
4 changed files with 37 additions and 0 deletions

2
.gitignore vendored
View file

@ -11,3 +11,5 @@ target/
#old source #old source
_src _src
_visualizer.json

26
Cargo.lock generated
View file

@ -771,6 +771,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [ dependencies = [
"ahash 0.7.6", "ahash 0.7.6",
"serde",
] ]
[[package]] [[package]]
@ -897,6 +898,12 @@ dependencies = [
"windows-sys 0.45.0", "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]] [[package]]
name = "jni-sys" name = "jni-sys"
version = "0.3.0" version = "0.3.0"
@ -935,6 +942,7 @@ dependencies = [
"nohash-hasher", "nohash-hasher",
"postcard", "postcard",
"rayon", "rayon",
"serde_json",
"shipyard", "shipyard",
"strum", "strum",
"uflow", "uflow",
@ -1611,6 +1619,12 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "ryu"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
[[package]] [[package]]
name = "safe_arch" name = "safe_arch"
version = "0.5.2" version = "0.5.2"
@ -1670,6 +1684,17 @@ dependencies = [
"syn", "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]] [[package]]
name = "serde_spanned" name = "serde_spanned"
version = "0.6.1" version = "0.6.1"
@ -1718,6 +1743,7 @@ dependencies = [
"hashbrown 0.12.3", "hashbrown 0.12.3",
"lock_api", "lock_api",
"rayon", "rayon",
"serde",
"shipyard_proc", "shipyard_proc",
] ]

View file

@ -21,11 +21,13 @@ flume = "0.10"
gilrs = { version = "0.10", default_features = false, features = ["xinput"] } gilrs = { version = "0.10", default_features = false, features = ["xinput"] }
uflow = "0.7" uflow = "0.7"
postcard = { version = "1.0", features = ["alloc"] } postcard = { version = "1.0", features = ["alloc"] }
serde_json = { version = "1.0", optional = true }
[target.'cfg(target_os = "windows")'.dependencies] [target.'cfg(target_os = "windows")'.dependencies]
winapi = { version = "0.3" } winapi = { version = "0.3" }
[features] [features]
default = [] default = []
generate_visualizer_data = ["serde_json", "shipyard/serde1"]
parallel = ["shipyard/parallel"] parallel = ["shipyard/parallel"]
nightly = ["glam/core-simd", "kubi-shared/nightly"] nightly = ["glam/core-simd", "kubi-shared/nightly"]

View file

@ -187,6 +187,13 @@ fn main() {
world.add_workload(render); world.add_workload(render);
world.add_workload(after_frame_end); 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 //Run startup systems
world.run_workload(startup).unwrap(); world.run_workload(startup).unwrap();