profiling

package
v0.1.0-rc.12 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 16 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 profiling records bounded, continuous diagnostics without exposing a network endpoint or forcing garbage collection.

Index

Constants

View Source
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

func Start(role string) (*Recorder, error)

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

func (r *Recorder) Close() error

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) Directory

func (r *Recorder) Directory() string

func (*Recorder) RecordGraphics

func (r *Recorder) RecordGraphics(value Graphics)

RecordGraphics receives a value snapshot from the rendering thread. No file I/O, profiling, or allocation occurs on that thread.

Jump to

Keyboard shortcuts

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