Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - add system information plugin and update relevant examples #5911

Closed
wants to merge 21 commits into from

Conversation

l1npengtul
Copy link
Contributor

Objective

Solve #5464

Solution

Adds a SystemInformationDiagnosticsPlugin to add diagnostics.

Adds Cargo.toml flags to fix building on different platforms.


Changelog

Adds sysinfo crate to bevy-diagnostics.

Changes in import order are due to clippy.

@l1npengtul
Copy link
Contributor Author

NOTE: possibly blocked by #5454

@IceSentry
Copy link
Contributor

It's not blocked on the log PR since this does something separate.

The general case config doesn't work on windows though. I simply used the default config for the general case. I think cargo is smart enough to pick the most applicable config.

@IceSentry
Copy link
Contributor

There's also still the potential issue that the sysinfo crate doesn't work when used with bevy_dynamic. I can't reproduce it myself though.

@@ -17,5 +17,7 @@ fn main() {
// .add_plugin(bevy::diagnostic::EntityCountDiagnosticsPlugin::default())
// Uncomment this to add an asset count diagnostics:
// .add_plugin(bevy::asset::diagnostic::AssetCountDiagnosticsPlugin::<Texture>::default())
// Uncomment this to add an System Info diagnostics:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: an System Info -> system info.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Uncomment this to add an System Info diagnostics:
// Uncomment this to add system info diagnostics:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks for catching that.

@IceSentry IceSentry added A-Diagnostics Logging, crash handling, error reporting and performance analysis C-Dependencies A change to the crates that Bevy depends on labels Sep 8, 2022
@l1npengtul
Copy link
Contributor Author

l1npengtul commented Sep 8, 2022

There's also still the potential issue that the sysinfo crate doesn't work when used with bevy_dynamic. I can't reproduce it myself though.

Ill try on my machine. Worst case sceneario, we throw away sys info and use the raw-platform APIs ourselves.

Or just disable the whole thing if using dynamic.

@IceSentry
Copy link
Contributor

I'd much prefer just disabling it when using dynamic or just have a separate feature flag for the crate. Based on the blog post of sysinfo, getting all of this isn't trivial and I don't think it's worth it to go through the trouble of reimplementing it ourselves.

@Nilirad Nilirad added the S-Needs-Investigation This issue requires detective work to figure out what's going wrong label Sep 20, 2022
@Nilirad
Copy link
Contributor

Nilirad commented Sep 20, 2022

Adding S-Needs-Investigation since it has the same problem of #5454 regarding dynamic linking.

@targrub
Copy link
Contributor

targrub commented Nov 30, 2022

With the advancement in dynamic linking on Windows, is this ready for investigation?
#2921

@alice-i-cecile
Copy link
Member

Yep, I think we can take a proper look at this now :)

@alice-i-cecile alice-i-cecile removed the S-Needs-Investigation This issue requires detective work to figure out what's going wrong label Nov 30, 2022
@l1npengtul
Copy link
Contributor Author

I'll take another look at this once I am free

@l1npengtul
Copy link
Contributor Author

My last comment was 2 days ago... I swore it was today...

Anyway, I have confirmed it working on my computer and I do not know how to solve the failing CI check.

I believe this is ready for a merge, if someone were to test this on Mac and Windows just to make sure...

@mockersf
Copy link
Member

mockersf commented Dec 3, 2022

and wasm, android and iOS?

@l1npengtul
Copy link
Contributor Author

Yep... forgot about those :p

WASM is the exception, sysinfo doesn't support WASM.

@IceSentry
Copy link
Contributor

IceSentry commented Dec 23, 2022

@l1npengtul I'd suggest updating the cargo.toml based on the one in #5454 after some testing it looks like we can use a simpler cargo.toml, but also, we can disable default-features. I disabled it because the only thing it does is enable multithreading, which causes a dependency conflict and we don't really need mutlithreading for this anyway.

Also, did you test it with dynamic linking enabled? If so, please leave a comment on the other PR. It will help both of these to get merged faster if we can confirm that it works.

@l1npengtul
Copy link
Contributor Author

@l1npengtul I'd suggest updating the cargo.toml based on the one in #5454 after some testing it looks like we can use a simpler cargo.toml, but also, we can disable default-features. I disabled it because the only thing it does is enable multithreading, which causes a dependency conflict and we don't really need mutlithreading for this anyway.

Also, did you test it with dynamic linking enabled? If so, please leave a comment on the other PR. It will help both of these to get merged faster if we can confirm that it works.

I think I did, I'll do it again to make sure.

Copy link
Contributor

@IceSentry IceSentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it on windows and wasm and it worked as expected.

On wasm, it gives a NaN unfortunately, but it doesn't break anything otherwise

image

@l1npengtul
Copy link
Contributor Author

I believe this is ready for merging.

@IceSentry
Copy link
Contributor

@l1npengtul I pushed a PR to your branch to remove the code duplication. I believe it's gonna be in a good state after that.

I also tried adding the log_sysinfo to the module, but it doesn't really work since the intention was for that log to always be there so I kept them separate.

@l1npengtul
Copy link
Contributor Author

Thank you IceSentry!

@IceSentry
Copy link
Contributor

My previous PR broke something, so I made a new PR to your repo. I went back a bit to having 2 mod internal but still extracted the common part and moved the log_system_info inside. This one should be good to go now.

@IceSentry
Copy link
Contributor

Green CI 🎉

@IceSentry
Copy link
Contributor

bors try

bors bot added a commit that referenced this pull request Jan 2, 2023
@l1npengtul
Copy link
Contributor Author

Thank you IceSentry!!

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jan 2, 2023
@alice-i-cecile
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Jan 2, 2023
# Objective
Solve #5464 

## Solution
Adds a `SystemInformationDiagnosticsPlugin` to add diagnostics.

Adds `Cargo.toml` flags to fix building on different platforms. 

---

## Changelog

Adds `sysinfo` crate to `bevy-diagnostics`. 

Changes in import order are due to clippy.

Co-authored-by: l1npengtul <[email protected]>
Co-authored-by: IceSentry <[email protected]>
@bors bors bot changed the title add system information plugin and update relevant examples [Merged by Bors] - add system information plugin and update relevant examples Jan 2, 2023
@bors bors bot closed this Jan 2, 2023
alradish pushed a commit to alradish/bevy that referenced this pull request Jan 22, 2023
…e#5911)

# Objective
Solve bevyengine#5464 

## Solution
Adds a `SystemInformationDiagnosticsPlugin` to add diagnostics.

Adds `Cargo.toml` flags to fix building on different platforms. 

---

## Changelog

Adds `sysinfo` crate to `bevy-diagnostics`. 

Changes in import order are due to clippy.

Co-authored-by: l1npengtul <[email protected]>
Co-authored-by: IceSentry <[email protected]>
bors bot pushed a commit that referenced this pull request Jan 22, 2023
# Problemo

Some code in #5911 and #5454 does not compile with dynamic linking enabled.
The code is behind a feature gate to prevent dynamically linked builds from breaking, but it's not quite set up correctly.

## Solution

Forward the `dynamic` feature flag to the `bevy_diagnostic` crate and gate the code behind it.


Co-authored-by: devil-ira <[email protected]>
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
…e#5911)

# Objective
Solve bevyengine#5464 

## Solution
Adds a `SystemInformationDiagnosticsPlugin` to add diagnostics.

Adds `Cargo.toml` flags to fix building on different platforms. 

---

## Changelog

Adds `sysinfo` crate to `bevy-diagnostics`. 

Changes in import order are due to clippy.

Co-authored-by: l1npengtul <[email protected]>
Co-authored-by: IceSentry <[email protected]>
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Problemo

Some code in bevyengine#5911 and bevyengine#5454 does not compile with dynamic linking enabled.
The code is behind a feature gate to prevent dynamically linked builds from breaking, but it's not quite set up correctly.

## Solution

Forward the `dynamic` feature flag to the `bevy_diagnostic` crate and gate the code behind it.


Co-authored-by: devil-ira <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Diagnostics Logging, crash handling, error reporting and performance analysis C-Dependencies A change to the crates that Bevy depends on S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants