Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upMake background hang monitor optional #25647
Comments
|
One way, perhaps the easiest, to do this, would:
Here: You could read the flag, and if we don't want to actually start a worker:
If the above solution is still too much, in the sense that components will still allocate and drop messages when they use the empty |
|
Maybe we can use the Lines 58 to 64 in 7ac4f9e |
|
Yes that could be a good idea, how would that work exactly with the BHM being a sub-crate and with the workspace setup of the repo as a whole? I'm looking around online and if you already know how it would be done, please describe it here! |
|
@gterzian I'm not familiar with how BHM works but I imagine maybe we can do it like For example, for the following piece of code, we will initiate the BHM if the feature is specified. let (background_monitor_register, sampler_chan) = if cfg!(feature = "background_hang_monitor") {
let (sampling_profiler_control, sampling_profiler_port) =
ipc::channel().expect("ipc channel failure");
(
Some(HangMonitorRegister::init(
background_hang_monitor_sender.clone(),
sampling_profiler_port,
)),
vec![sampling_profiler_control],
)
} else {
(None, vec![])
};servo/components/constellation/constellation.rs Lines 846 to 862 in 393b676 Maybe @jdm will have better plan though, WDYT |
|
|
|
Looks like a good idea. I think what I proposed with different implementations of the current traits is actually too complicated. |
|
As a developer, it would be ideal if this were a runtime rather than compile-time choice. My preference would be using Options around channels like we do with the devtools server. |
|
@jdm could you point out the devtools server implementation that you referred above. It would be helpful if I take a look at it first. |
|
If I wrap the value in background_hang_monitor_receiver inside Option, how do I handle it inside select macro? servo/components/constellation/constellation.rs Lines 1416 to 1418 in 87d28b9 |
|
I think the example "Optionally add a receive operation to select! using never" could be useful for this, see https://docs.rs/crossbeam-channel/0.4.0/crossbeam_channel/macro.select.html |
Make Background Hang Monitor Optional This is done by wrapping all channels of communication and related objects inside Option which are configured using flag inside servo_config. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25647 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Make Background Hang Monitor Optional This is done by wrapping all channels of communication and related objects inside Option which are configured using flag inside servo_config. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25647 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Make Background Hang Monitor Optional This is done by wrapping all channels of communication and related objects inside Option which are configured using flag inside servo_config. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25647 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Make Background Hang Monitor Optional This is done by wrapping all channels of communication and related objects inside Option which are configured using flag inside servo_config. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25647 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
In performance-sensitive situations like immersive mode on the hololens, having the background hang monitor thread running shows up in profiles. We should make it a configuration option at engine startup, and put the channels to communicate with the thread inside Option values so we don't have unnecessary channel traffic.