Live CPU% in container/stack vitals#11
Merged
Merged
Conversation
- VitalsSampler (ConsaiCore): pure, testable cpu%-from-cumulative-usec sampling, extracted from the view model so the domain logic lives in the domain layer - ContainerEngine.cpuUsage(id:) via SDK stats; AppState samples cpu+mem concurrently and carries last-known vitals to avoid blink; vitals render IP · cpu% · mem on one line - Tests: cpuPercent math + sampler first-reading/retain behavior (23 ConsaiCore tests pass) Closes #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Completes the instrument vitals: rows now show IP · CPU% · memory (memory shipped earlier; CPU was the gap from #1).
Changes
VitalsSampler(ConsaiCore) — pure, stateful value type that turns successive cumulativecpuUsageUsecreadings into a CPU %, extracted from the view model so the sampling logic lives in the domain layer and is unit-testable (per SwiftUI guidance: business logic in services/models, not views).ContainerEngine.cpuUsage(id:)via the SDKstatsAPI;AppStatefetches CPU + memory concurrently for running containers and carries last-known vitals so they don't blink between polls.IP · cpu% · memon a single line (fixedSize; the image truncates instead of wrapping).Tests
cpuPercentmath (incl. zero-window and counter-reset guards) +VitalsSamplerfirst-reading/retainbehavior. 23 ConsaiCore tests pass.Notes
swift build+swift test; panel screenshot refreshed indocs/screenshots/.Closes #1