summaryrefslogtreecommitdiff
path: root/internal/statsengine/engine.go
AgeCommit message (Collapse)Author
2026-05-20task 07: add KindMem and separate address-space byte accountingPaul Buetow
2026-05-18t6 add syscall family dashboard aggregationPaul Buetow
2026-05-13introduce Accumulator interface in statsengine to separate ingestion from ↵Paul Buetow
snapshot-building Define statsengine.Accumulator (Ingest + Reset) to represent the event-accumulation responsibility separately from runtime.SnapshotSource (Snapshot), which handles the read side. This reduces the SRP violation in Engine: callers that only push events now hold an Accumulator; callers that only read statistics hold a SnapshotSource. - Add Accumulator interface and compile-time assertion in statsengine/engine.go - Add EventIngester type alias (= statsengine.Accumulator) in runtime/runtime.go with a compile-time assertion, so callers in the runtime layer can reference the ingestion contract without importing statsengine directly - Split tuiRuntime.engine field into accumulator + snapSource so the event-loop callback holds Accumulator and wireRuntimeBindings passes SnapshotSource to SetDashboardSnapshotSource — making each consumer's dependency explicit - Simplify resetDashboardSnapshotSource in tui.go to cast for interface{ Reset() } independently of Snapshot(), removing the combined ad-hoc interface check Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13use errgroup instead of WaitGroup for concurrent snapshot buildersPaul Buetow
Replace sync.WaitGroup with errgroup.Group in buildSubSnapshots so errors from sub-builders (buildSyscallSnapshots, buildFileSnapshots, buildProcessSnapshots, buildHistogramSnapshot) are captured and propagated rather than silently dropped. Change Engine.Snapshot() to return (*Snapshot, error), update runtime.SnapshotSource and dashboard.SnapshotSource interfaces accordingly, and adjust all callers in tui.go, dashboard/model.go, and the test helpers. Each sub-builder now returns (result, error); the error return is currently always nil but establishes the contract for future validation. The per-type Snapshot() convenience methods (histogram, syscall, file, process) panic on error since they are internal helpers where failure would be a programming bug. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13enforce gofmt formatting and add Fmt/FmtCheck mage targetsPaul Buetow
Run gofmt -w on 9 files that had minor alignment/whitespace drift (pair.go, filter.go, ior_mode_registry.go, ior_mode_test.go, runtime.go, engine.go, dashboard/model.go, flamegraph/model.go, flamegraph/renderer.go). Add two new Mage targets to Magefile.go: - `mage fmt` – rewrites all .go files in-place via go/format - `mage fmtCheck` – dry-run check; fails with a list of offending files, suitable as a CI gate Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12add DefaultTopN constant to statsengine and replace hard-coded 64 capacity ↵Paul Buetow
values Introduces statsengine.DefaultTopN = 64 as the canonical named constant for the top-N capacity used when constructing an Engine. Removes the local defaultEngineCapacity constant from runtime_builder.go and updates all call sites to reference statsengine.DefaultTopN instead of bare 64. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12refactor: split Snapshot in statsengine to comply with 50-line limitPaul Buetow
Extract captureSnapshotInputs (lock-guarded state copy), buildSubSnapshots (concurrent per-category builders), and populateSnapshotFields (scalar field assignment) from the monolithic Snapshot method. The method itself is now 18 lines; all three helpers are well under 30 lines each. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05Normalize Go import grouping with local ior sectionPaul Buetow
2026-02-25Fix stream paused scrolling and apply pending TUI/probe updatesPaul Buetow
2026-02-25Parallelize snapshot builders in stats enginePaul Buetow
2026-02-24statsengine: compact process accumulator at high cardinalityPaul Buetow
2026-02-24statsengine: build snapshots outside engine mutexPaul Buetow
2026-02-23task 302: add stats engine orchestration and snapshotsPaul Buetow