{"modulePath":"github.com/pencode-labs/pencode","version":"v0.1.0-rc.15","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package profiling\n\nPackage profiling records bounded, continuous diagnostics without exposing a network endpoint or forcing garbage collection.\n\n## Constants\n\n```go\nconst SampleInterval = 5 * time.Second\n```\n\n## Functions\n\n```go\nfunc DefaultEnabled() bool\n```\nDefaultEnabled reports the build's default when no setting overrides it.\n\n## Types\n\n```go\ntype Graphics struct {\n\tSampledAt          time.Time `json:\"sampled_at\"`\n\tBackend            string    `json:\"backend\"`\n\tDevice             string    `json:\"device\"`\n\tInstanceBytes      uint64    `json:\"instance_bytes\"`\n\tStagingBytes       uint64    `json:\"staging_bytes\"`\n\tReadbackBytes      uint64    `json:\"readback_bytes\"`\n\tNativeScratchBytes uint64    `json:\"native_scratch_bytes\"`\n\tGoScratchBytes     uint64    `json:\"go_scratch_bytes\"`\n\tTextureCacheBytes  uint64    `json:\"texture_cache_bytes\"`\n\tBuffersAvailable   bool      `json:\"buffers_available\"`\n}\n```\nGraphics 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.\n\n```go\ntype Recorder struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc Start(role string) (*Recorder, error)\n```\nStart 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.\n\n```go\nfunc (r *Recorder) Close() error\n```\nClose flushes the current CPU segment and final snapshots. It is safe to call repeatedly, or on a nil recorder when profiling is disabled.\n\n```go\nfunc (r *Recorder) Directory() string\n```\n\n```go\nfunc (r *Recorder) RecordGraphics(value Graphics)\n```\nRecordGraphics receives a value snapshot from the rendering thread. No file I/O, profiling, or allocation occurs on that thread.\n\n","path":"github.com/pencode-labs/pencode/internal/profiling","name":"profiling","synopsis":"Package profiling records bounded, continuous diagnostics without exposing a network endpoint or forcing garbage collection.","isRedistributable":true}
