Defer widget refresh work and enrich diagnostics #713
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
renderreads snapshots only and deferring IO/work to background/flush steps.renderand to schedule expensive refreshes via caches/timers.Description
DashboardDataCacheby addingRefreshRequestsand methodsrequest_refresh_*andflush_refresh_requeststo queue refreshes and run them before dashboard rendering viaflush_refresh_requestsinsrc/gui/mod.rs.render(examples:todo,todo_focus,process_list,recycle_bin,system_status, and clipboard/system snapshot handling inclipboard_snippetsnow requests system-status refresh and reads snapshot only).startandendInstants insrc/dashboard/dashboard.rsand updated diagnostics to record start/end timestamps, duration, and athrottledflag (threshold bumped to100ms) insrc/dashboard/diagnostics.rs.src/dashboard/widgets/diagnostics.rs) to showStart,End,Modeand a warning indicator for throttled (slow) refreshes, and added a short checklist comment near theWidgettrait insrc/dashboard/widgets/mod.rsto document expected render behavior.src/dashboard/diagnostics.rsto verify snapshot throttling, timing capture, and update/throttle semantics.Testing
testsinsrc/dashboard/diagnostics.rs) and attempted to run them withcargo test widget_refreshwhich failed during the build due to an unrelated native dependency missing on the environment (alsapkg-config/alsa.pcnot found), so the test run did not complete successfully.alsa-sys), and the new tests are present and validate the intended diagnostic behaviors when run in an environment with required native libs.Codex Task