terminalperf

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package terminalperf exposes privacy-safe counters for the visible terminal pipeline. The hot path records only fixed event kinds: terminal text, paths, targets, session names, and provider payloads cannot enter a probe.

Index

Constants

View Source
const SnapshotPath = "/debug/terminalperf"

SnapshotPath is the localhost-only diagnostic route served alongside pprof when SIDECAR_TERMINAL_PERF is enabled by the Sidecar process.

Variables

This section is empty.

Functions

func Add

func Add(event Event, count int)

Add records count occurrences without exposing dynamic labels.

func Install

func Install(counters *Counters) (restore func())

Install routes subsequent events to counters until the returned restore function is called. It is intended for a benchmark, isolated proof, or a production diagnostic owner that can scope the installation.

func Record

func Record(event Event)

Record increments a fixed event counter when a probe is installed.

func RecordOutputToFrame

func RecordOutputToFrame(duration time.Duration)

RecordOutputToFrame records a fixed numeric duration only. Millisecond buckets are enough to decide the 50ms presentation gate without retaining terminal content, targets, or a per-frame timestamp trail.

func SnapshotHandler

func SnapshotHandler(counters *Counters) http.Handler

SnapshotHandler exposes only the fixed numeric counter vocabulary. It is a read-only development diagnostic, not a product API.

Types

type Counters

type Counters struct {
	// contains filtered or unexported fields
}

Counters is an injectable recorder. It is intentionally data-free apart from counts so enabling it can never retain terminal content or user identity.

func (*Counters) Snapshot

func (c *Counters) Snapshot() Snapshot

Snapshot returns the current fixed counters.

type Event

type Event uint8

Event is one fixed terminal-pipeline operation.

const (
	ModelFrameBuilt Event = iota + 1
	ModelFramePublished
	TerminalViewRendered
	RowCacheHit
	RowCacheMiss
	ContentLinkResolutionRequest
	ContentLinkResolutionCacheHit
	SynchronousResolverCall
	GlobalWorkspaceListRendered
	GlobalWorkspacePreviewRendered
)

type Snapshot

type Snapshot struct {
	ModelFramesBuilt               uint64 `json:"model_frames_built"`
	ModelFramesPublished           uint64 `json:"model_frames_published"`
	TerminalViewsRendered          uint64 `json:"terminal_views_rendered"`
	RowCacheHits                   uint64 `json:"row_cache_hits"`
	RowCacheMisses                 uint64 `json:"row_cache_misses"`
	ContentLinkResolutionRequests  uint64 `json:"content_link_resolution_requests"`
	ContentLinkResolutionCacheHits uint64 `json:"content_link_resolution_cache_hits"`
	SynchronousResolverCalls       uint64 `json:"synchronous_resolver_calls"`
	GlobalWorkspaceListRendered    uint64 `json:"global_workspace_list_rendered"`
	GlobalWorkspacePreviewRendered uint64 `json:"global_workspace_preview_rendered"`
	OutputToFrameSamples           uint64 `json:"output_to_frame_samples"`
	OutputToFrameP95US             uint64 `json:"output_to_frame_p95_us"`
	OutputToFrameMaxUS             uint64 `json:"output_to_frame_max_us"`
}

Snapshot is a point-in-time copy suitable for benchmark metrics or diagnostics. Field names are the complete diagnostic vocabulary.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL