profiling

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package profiling adds an env-gated CPU/heap profiler to the mdsmith CLI. It exists so a tripped performance gate can be diagnosed: the gate says "check got slower", a profile says "here is the function". There is no CLI flag on purpose — the hyperfine command strings stay byte-identical to production, so the profiled run measures the same path users hit.

MDSMITH_CPUPROFILE=cpu.out mdsmith check .
go tool pprof -top cpu.out

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start() (stop func())

Start reads MDSMITH_CPUPROFILE / MDSMITH_MEMPROFILE and begins profiling for any that are set. The returned stop function is always non-nil and must be called once before process exit; it finalizes whatever was started. When neither var is set, Start is a no-op and stop does nothing.

Wire it as `defer profiling.Start()()` from the normal return path. A code path that calls os.Exit directly bypasses the deferred stop and leaves the profile truncated or empty — acceptable for a dev aid, but the reason profiles are only reliable for the standard return path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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