history: Delay saving history even on low power

System Internals / UPower - Benjamin Berg [redhat.com] - 27 January 2022 13:48 UTC

Otherwise we flush out the data much more often than needed. With this change, we'll also wait up to 5 seconds even on lower power. Loosing 5s of data shouldn't be too bad, and it may prevent additional disk writes.

But, more importantly, we need to deferre writing the data to a later main loop iteration. If we did not do this, then we have an write-amplification scenario where the history is written at least 4 times instead of once.

Closes: #150

d113f62 history: Delay saving history even on low power
src/linux/integration-test.py | 45 +++++++++++++++++++++++++++++++++++++++++++
src/up-history.c | 44 ++++++++++++++++++++++++++----------------
2 files changed, 72 insertions(+), 17 deletions(-)

Upstream: cgit.freedesktop.org


  • Share