summaryrefslogtreecommitdiff
path: root/internal
AgeCommit message (Collapse)Author
2026-05-12refactor tuiTraceStarterFromRunTrace and runTraceWithContext to comply with ↵Paul Buetow
50-line limit Extract buildTUIRuntime and makeTUIEventLoopConfigurer from the monolithic tuiTraceStarterFromRunTrace closure, and extract maybePrependFlamegraphConfigure and finaliseTrace from runTraceWithContext. All functions are now <= 50 lines. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12refactor: split handleGlobalKeyPress into focused helpers under 50 linesPaul Buetow
Extract handleHelpOverlayKeyPress, handleQuitKeyPress, routeQuitAsEsc, and handleDashboardShortcutKeys from the 89-line handleGlobalKeyPress to comply with the project's 50-line function limit. All existing behaviour is preserved. 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-05-12refactor flamegraph model.go: split Update and frameIndexAt below 50-line limitPaul Buetow
Extract handleSearchInput and handleKeyNavigation from Update (111 lines → 33), then split handleKeyNavigation into handleModeKey and handleMovementKey. Extract frameCoordToTargetRow and findFrameAtRow from frameIndexAt (66 lines → 32). All new helpers are ≤ 29 lines; behavior is preserved. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11speed up flame graph TUI under heavy event loadPaul Buetow
Move the per-tick snapshot refresh off the Bubble Tea update goroutine, add a frame ancestry index so navigation and filter helpers run in O(subtree) instead of O(frames), skip refresh and animation while the user is actively pressing keys, and memoize View() output. Keystrokes (pause, filter, navigate) now land within one frame even when the live trie ingests thousands of events per tick. - new SnapshotTree() on LiveTrie bypasses JSON marshal+unmarshal - RefreshFromLiveTrieCmd runs SnapshotTree + layout + ancestry on a background goroutine, coalesced via refreshInFlight, and returns a flameSnapshotReadyMsg the Update loop applies cheaply - driveWindow gate (250 ms after last key press) skips refresh dispatch and snaps frames directly to target without animation while the user is driving - View() caches its rendered string keyed on the inputs that affect output; cache is bypassed during animation Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09show auto-reset countdown and document the cyclePaul Buetow
Renders the next-tick countdown ("12s/30s") in the dashboard chrome so users can see when aggregates will clear, and adds a dedicated H-help line spelling out the cycle keys (off → 10s → 30s → 1m → 2m → 5m). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09refine auto-reset timer cycle and pause on blurPaul Buetow
Two follow-up refinements to the auto-reset timer added in 8da473a. - Hotkey cycle now goes off -> 10s -> 30s -> 60s -> 2m -> 5m -> off, giving the user finer control between 60s and 5m and a quicker starting cadence. - The timer now pauses while the TUI is blurred. SetFocused returns a tea.Cmd that re-arms a fresh tick on focus regain, and bumps the generation counter on every focus change so any tick scheduled before blur is dropped on arrival. autoResetTickCmd and handleAutoResetTick also gate on m.focused as defense in depth. - Dashboard chrome shows 'auto-reset: 30s (paused)' while the timer is enabled but blurred, distinguishing it from the disabled 'off' state. Tests cover the full preset cycle (including custom-value passthrough) and the pause-on-blur lifecycle: stale ticks ignored, current-gen ticks ignored while blurred, focus regain re-arms and fires the reset, no-op focus calls don't churn the generation counter, and the chrome label flips to '(paused)' as expected. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09add auto-reset timer for dashboard aggregatesPaul Buetow
Live flamegraph trie and stats engine grow unboundedly during long traces. Add a periodic auto-reset (same effect as the 'r' key) so they stay bounded. - New CLI flag -resetTimer=30s (default 30s, 0 disables). - Hotkey I cycles the cadence: off -> 15s -> 30s -> 60s -> 5m -> off. Custom intervals (e.g. -resetTimer=47s) advance to the first preset greater than the current value, then wrap to off. - autoResetTickMsg carries a generation counter so changing the cadence drops in-flight ticks scheduled under the previous interval. - Dashboard chrome shows 'auto-reset: 30s' or 'auto-reset: off'.
2026-05-08reconnect flamegraph live trie after in-place filter swapPaul Buetow
PrepareForTraceRestart was designed for the full-restart path, where the dashboard's live-trie reference is rebound when TracingStartedMsg fires. The in-place filter swap skips that message, leaving the flamegraph tab stuck on 'Flame: waiting for data...' until the next real trace restart. Re-bind via SetLiveTrie immediately after PrepareForTraceRestart in both applyGlobalFilter and undoGlobalFilter.
2026-05-08swap global filter in place to skip BPF reattachPaul Buetow
Changing the global filter used to call stopTrace + beginTraceCmd, which detached and re-attached every tracepoint and re-loaded the BPF object. On heavily loaded I/O systems that took several seconds and showed an 'Attaching tracepoints...' overlay each time. The probe set never depends on the global filter (ShouldIAttachTracepoint only reads CLI regex flags), so the restart was gratuitous. Now the eventloop holds its filter behind atomic.Pointer with SetFilter / Filter accessors, and the trace starter registers el.SetFilter via the runtime bindings as a SetLiveFilterSetter callback. applyGlobalFilter and undoGlobalFilter call runtime.applyLiveFilter first; only if no trace is running do they fall back to the full restart path.
2026-05-08add duration metric, tolerate missing tracepoints, ship el8 buildPaul Buetow
- Bubbles, treemap, icicle, and the live flamegraph 'b' cycle now include syscall duration (sum) as a third metric alongside events and bytes. Statsengine snapshots expose TotalLatencyNs to support this. - AttachAll takes an optional warn callback. Production passes one so older kernels that lack newer tracepoints log a warning and keep going instead of aborting startup. - Dockerfile.el8 + scripts/build-with-docker-el8.sh + mage buildDockerEl8 produce ior.el8, a static binary built against Rocky Linux 8 glibc for RHEL/Rocky/Alma 8 hosts. - README.md documents installing mage and the new el8 target.
2026-05-07release 1.0.0v1.0.0Paul Buetow
2026-05-07update docs and ascii bannerPaul Buetow
2026-05-06add Dockerfile and Rocky Linux 9 build docsPaul Buetow
Introduces a Docker-based build path so ior can be compiled on any Linux host without a native Rocky 9 toolchain setup: - Dockerfile: Rocky 9 minimal image with Go (version from ARG, default from go.mod), static libelf/libzstd built from source, libbpfgo at v0.9.2-libbpf-1.5.1, and mage; CMD runs mage generate + mage all against the repo root mounted as a volume. - scripts/build-with-docker.sh: reads GO_VERSION from go.mod, passes it as --build-arg to docker build, mounts tracefs and BTF into the container, writes the binary to the repo root. - Magefile.go: adds BuildDocker target that wraps the script. - README.md: simplified to the two build paths (Docker + native) with links to docs/; removed GOTOOLCHAIN=auto throughout. - docs/build-rocky-linux-9.md: full manual Rocky 9 steps, libbpfgo toolchain setup/rollback, compile-once-run-everywhere explanation, and timing semantics. - docs/tui-reference.md: complete TUI hotkey reference, recording mode details, and the .ior.zst vs Parquet trade-off table. - AGENTS.md: removed GOTOOLCHAIN=auto from all build commands. - internal/c/generated_tracepoints.c: regenerated against the host kernel. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02fix BPF tracepoint context type for RHEL 9 stock kernelPaul Buetow
The BPF handler generator emitted struct trace_event_raw_sys_enter/ trace_event_raw_sys_exit (the BTF-blessed aliases). RHEL 9 carries an rt-tree backport that adds preempt_lazy_count to struct trace_entry, which widens those aliases by 8 bytes and shifts args/ret. The actual tracepoint context the kernel hands the program is still syscall_trace_enter / syscall_trace_exit, where the offsets did not move. Programs typed against the wider alias read past max_ctx_offset and the verifier rejects the attach with EACCES. Switching the generator to emit syscall_trace_enter/exit lines up with the real context on RHEL 9 (and is identical on every other distro, since the two structs only diverge there). Same fix bcc shipped in iovisor/bcc#4920 and inspektor-gadget did in inspektor-gadget#2546. Field accesses (ctx->args[N], ctx->ret) are unchanged. Verified end-to-end on Rocky Linux 9.7 stock 5.14.0-611.5.1.el9_7 (no kernel-ml needed) and Fedora 6.19. README rewritten accordingly: drops the elrepo kernel-ml step and the trailing 'permission denied' troubleshooting paragraph; adds a historical note explaining why the old workaround existed. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-24fix task 38: plug profiling fd leak on setup failure pathsPaul Buetow
runTraceWithContext and runHeadlessParquet opened cpu/mem/exec-trace profile files via setupProfiling, then relied on the shutdown watcher goroutine (registered later) to close them. If any intervening step (newEventLoop, recorder.Start) returned an error, the watcher was never registered and the profile fds leaked until process exit. Add a defer profiling.stop(logln) immediately after setupProfiling so the fds are released on every return path. profiling.stop is idempotent via sync.Once so the watcher and defer can both run harmlessly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18chore: bump version to v0.0.1v0.0.1Paul Buetow
2026-04-18Fix Recorder.Stop error propagation for task 65Paul Buetow
2026-04-18fix probemanager close serialization for task 55Paul Buetow
2026-04-18fix probemanager attach race for task 55Paul Buetow
2026-04-18fix task 45: bound pending handle cleanupPaul Buetow
2026-04-18Fix task 35: treat negative fcntl errno as failurePaul Buetow
2026-03-18cleanupPaul Buetow
2026-03-18refactor: extract keyboardState, filterState, processState sub-structs from ↵Paul Buetow
tui.Model (task 429) tui.Model had 33 fields mixing keyboard tracking, filter chain, process selection, and UI presentation concerns (SRP violation). Extract three focused sub-structs: - keyboardState (kb): enhancements, lastEvent{ID,At,WasPress}, suppress{ID,Until} — 7 fields managed by keys_normalize.go - filterState (filter): global filter, history slice, label stack — 3 fields for the trace filter chain - processState (proc): pid, tid, pickerReturn — 3 fields for PID/TID selection and picker navigation Model drops from 33 to 23 top-level fields. All field accesses in tui.go, keys_normalize.go, and tui_test.go are updated accordingly. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-18refactor: split TraceRuntimeBindings into RuntimePublisher and RuntimeState ↵Paul Buetow
(task 427/ISP) TraceRuntimeBindings mixed 4 setter methods (injecting data into TUI) with 4 getter methods (reading persistent TUI-owned state), violating ISP. Split into two focused interfaces: - RuntimePublisher: SetDashboardSnapshotSource, SetEventStreamSource, SetLiveTrie, SetProbeManager — the write/inject side - RuntimeState: StreamBuffer, Recorder, StreamSequencer, FilterEpoch — the read/persistent-state side TraceRuntimeBindings now embeds both, preserving all existing call sites. RuntimePublisherFromContext() added so callers that only inject data do not see the getter surface. Three such callers are narrowed: setupBPFModule, tuiTestFlamesStarter, tuiTestLiveFlamesStarter. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-18refactor: split ior.go mega-file into focused files (task 427)Paul Buetow
ior.go had 763 lines covering 9+ concerns. Follow the eventloop_*.go pattern and extract into three focused files: - ior_bpfsetup.go: libbpfTracepoint{Program,Module} adapter types, setupBPFModule, setupBPFModuleError, setupEventChannel - ior_profiling.go: profilingControl type, setupProfiling, profilingFilesForMode, stop() - ior_parquet_sink.go: headlessParquetSink type, runHeadlessParquet, isHeadlessParquetMode, hasHeadlessParquetContentFilters, headlessParquetTraceConfig; inline parquetMetadata one-liner ior.go shrinks from 763 → 453 lines, retaining entry, dispatch, TUI wiring, and core trace execution. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-18refactor: pass flags.Config explicitly, remove flags.Get() from library code ↵Paul Buetow
(task 429) flags.Get() (global mutable singleton) was called inside library packages, coupling them to global state and making tests fragile (DIP violation). - internal.Run() now takes an explicit flags.Config; main.go calls flags.Get() once at the CLI boundary and passes it in. - tui.Run(), RunWithTraceStarter(), RunTestFlamesWithTraceStarter() removed; callers already used the WithConfig variants directly. - tui.NewModel() preserved for test ergonomics but now uses flags.NewFlags() (pure defaults) instead of flags.Get() (global state). - Tests updated to use NewModelWithConfig() with explicit config structs instead of flags.Set*() + NewModel(), eliminating all test-level global-state mutation. flags.Get() is now called only in cmd/ior/main.go, the correct boundary. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-18refactor: extract pairTracker and extend fdTracker to reduce eventLoop ↵Paul Buetow
responsibilities (task 428) The eventLoop struct held 20+ fields across 5+ responsibilities (SRP violation). Extract two cohesive sub-structs: - pairTracker: enter/exit pair matching, age-based LRU pruning, and DurationToPrev tracking. Replaces enterEvs/enterEvAges/prevPairTimes/ maxPendingEnterEvs/cacheAge fields with a single embedded value. - fdTracker (extended): absorbs procFdCache/procFdAges/maxProcFdCacheSize, moving all procfs-resolution cache logic (resolve, cache, prune, delete) off eventLoop and onto the tracker that already owns the fd table. eventLoop drops from 20 fields to 12. All methods that previously reached into eventLoop fields now live on the struct that owns the data. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-18refactor: replace reflect.TypeOf dispatch in exit handlers with type switch ↵Paul Buetow
(task 432) The exitHandlers map keyed by reflect.Type was a reflection-based dispatch table that incurred allocation and reflection overhead on every event pair in the hot processing path. Replace it with a plain type switch in handleTracepointExit, which the compiler resolves statically. Removes: initExitHandlers, typeKey, mustBeType, newTypedExitHandler, exitHandlerRegistry, the exitHandlers struct field, and the tracepointExitHandler type alias — all dead after the switch. Fixes a pre-existing uint→uint64 mismatch in stats(). Updates tests to target the new default branch directly. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-13Reorder flags declarations (task 390)Paul Buetow
2026-03-13Handle procfs lookup errors in event loop (task 392)Paul Buetow
2026-03-13Refactor event loop into focused units (task 389)Paul Buetow
2026-03-13docs: explain parquet recording modesPaul Buetow
2026-03-13perf: remove tui stream relay channelPaul Buetow
2026-03-13bench: add parquet recording benchmarksPaul Buetow
2026-03-13test: expand parquet recording coveragePaul Buetow
2026-03-13feat: add tui parquet recording controlsPaul Buetow
2026-03-13feat: add headless parquet recording modePaul Buetow
2026-03-12feat: persist parquet recording across TUI restartsPaul Buetow
2026-03-12feat: add parquet recorder foundationPaul Buetow
2026-03-12refactor: extract shared syscall stream row modelPaul Buetow
2026-03-12fix: restore legacy flamegraph trace output modePaul Buetow
2026-03-12internal: embed BPF object into ior binaryPaul Buetow
2026-03-11eventloop: factor malformed-event helpers (task 383)Paul Buetow
2026-03-10dashboard: centralize nil snapshot fallback (task 385)Paul Buetow
2026-03-10dashboard: unify viewport chrome calculation (task 388)Paul Buetow
2026-03-10globalfilter: genericize filter clone helpers (task 385)Paul Buetow
2026-03-10dashboard: unify offset reanchoring helper (task 394)Paul Buetow
2026-03-10config: centralize default buffer sizes (task 388)Paul Buetow
2026-03-10file: document File interface semantics (task 399)Paul Buetow