Documentation
¶
Overview ¶
Package profiling records bounded, continuous diagnostics without exposing a network endpoint or forcing garbage collection.
Index ¶
Constants ¶
const SampleInterval = 5 * time.Second
Variables ¶
This section is empty.
Functions ¶
func DefaultEnabled ¶
func DefaultEnabled() bool
DefaultEnabled reports the build's default when no setting overrides it.
Types ¶
type Graphics ¶
type Graphics struct {
SampledAt time.Time `json:"sampled_at"`
Backend string `json:"backend"`
Device string `json:"device"`
InstanceBytes uint64 `json:"instance_bytes"`
StagingBytes uint64 `json:"staging_bytes"`
ReadbackBytes uint64 `json:"readback_bytes"`
NativeScratchBytes uint64 `json:"native_scratch_bytes"`
GoScratchBytes uint64 `json:"go_scratch_bytes"`
TextureCacheBytes uint64 `json:"texture_cache_bytes"`
BuffersAvailable bool `json:"buffers_available"`
}
Graphics is a partial resource inventory, not total GPU residency. Native scratch is CPU memory; Go scratch overlaps the Go heap. TextureCacheBytes is the workbench's logical texture size, excluding fonts and driver overhead. SampledAt remains unchanged while the UI is idle, making stale data explicit.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
func Start ¶
Start reads the host's pprof setting, falling back to DefaultEnabled. PENCODE_DEBUG overrides the setting; PENCODE_PROFILE_DIR selects the parent directory. Each process owns a unique subdirectory, including local servers.
func (*Recorder) Close ¶
Close flushes the current CPU segment and final snapshots. It is safe to call repeatedly, or on a nil recorder when profiling is disabled.
func (*Recorder) RecordGraphics ¶
RecordGraphics receives a value snapshot from the rendering thread. No file I/O, profiling, or allocation occurs on that thread.