Skip to content

Update cvd monitor to use inotify#2692

Merged
rmuthiah merged 1 commit into
google:mainfrom
Databean:update-monitor-inotify
Jun 12, 2026
Merged

Update cvd monitor to use inotify#2692
rmuthiah merged 1 commit into
google:mainfrom
Databean:update-monitor-inotify

Conversation

@Databean

Copy link
Copy Markdown
Member

This replaces the 50ms polling loop with an event-driven approach using inotify to wait for log file changes, implementing FIONREAD event coalescing and a 20 FPS rate-limiting throttle to protect terminal bandwidth during log storms.

Assisted-by: Jetski:Gemini Next

@Databean Databean requested a review from jemoreira June 10, 2026 23:37
Comment thread base/cvd/cuttlefish/host/commands/cvd/cli/commands/monitor/command_handler.cc Outdated
Comment thread base/cvd/cuttlefish/host/commands/cvd/cli/commands/monitor/command_handler.cc Outdated
This replaces the 50ms polling loop with an event-driven approach using
inotify to wait for log file changes. It implements stack-based, non-blocking
event coalescing and a 20 FPS rate-limiting throttle to protect terminal
bandwidth and CPU during log storms.

Additionally, this adds InotifyAddWatch retries on every frame if watches
fail or log files are missing, refactors the retrying logic into a reusable
mutating helper function, supervises the loop with SharedFD::Poll() and a single
unified drain read using a dynamic 1-second fallback timeout, supervises
read operations with CF_EXPECT / CF_EXPECTF to catch unexpected errors,
and eliminates initial frame throttling delays by starting with a 0 epoch draw time.

Assisted-by: Jetski:Gemini Next
@Databean Databean force-pushed the update-monitor-inotify branch from 0e4f9fc to 52e1551 Compare June 11, 2026 18:44
@Databean

Copy link
Copy Markdown
Member Author

Thanks for reviewing!

@Databean Databean requested a review from jemoreira June 11, 2026 20:00
@Databean Databean enabled auto-merge June 11, 2026 21:49
@Databean Databean added this pull request to the merge queue Jun 11, 2026
@rmuthiah rmuthiah removed this pull request from the merge queue due to a manual request Jun 11, 2026
@rmuthiah rmuthiah added this pull request to the merge queue Jun 12, 2026
Merged via the queue into google:main with commit 2ef7fdd Jun 12, 2026
73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants