xhcid: Sleep for 2ms on every poll loop

This significantly reduces cpu usage. On my laptop before this change a
single core would be fully loaded while running at 3-4GHz. With this
change it would only be loaded for about 50% while running at 1-2GHz.
This improves battery lifetime while also preventing the fan from
spinning up to a distracting level.

This shouldn't noticably affect latency given that most keyboards and
mice don't support polling at 500Hz anyway.
This commit is contained in:
bjorn3
2024-06-16 12:04:05 +02:00
parent e1a2e21735
commit 0d926fb3f7
+1 -1
View File
@@ -105,7 +105,7 @@ impl IrqReactor {
}
// TODO: Configure the amount of time wait when no more work can be done (for IRQ-less polling).
fn pause(&self) {
std::thread::yield_now();
std::thread::sleep(std::time::Duration::from_millis(2));
}
fn run_polling(mut self) {
debug!("Running IRQ reactor in polling mode.");