Documentation
¶
Overview ¶
Package perf is lightweight, opt-in instrumentation: named counters (Count) and timers (Record/Time) that flush to a log for the headless harness and the perf baselines. It is disabled by default in production.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnableForTest ¶ added in v0.0.12
func EnableForTest() func()
EnableForTest forces perf collection on (and disables periodic logging). It returns a restore function to reset prior settings.
func Flush ¶ added in v0.0.12
func Flush(reason string)
Flush logs a summary of current stats/counters immediately. If reason is provided, it is included in the log prefix.
func Init ¶ added in v0.0.20
func Init()
Init reads the AMUX_PROFILE / AMUX_PROFILE_INTERVAL_MS environment and arms profiling accordingly. The app calls this explicitly during construction; it is idempotent, so library users and tests may also call it directly.
func Reset ¶ added in v0.0.20
func Reset()
Reset clears all recorded stats and counters and re-reads the environment. Intended for tests that toggle AMUX_PROFILE between cases.
func Snapshot ¶ added in v0.0.12
func Snapshot() ([]StatSnapshot, []CounterSnapshot)
Snapshot returns current perf stats/counters and resets them.
Types ¶
type CounterSnapshot ¶ added in v0.0.12
CounterSnapshot captures perf counters for diagnostics/tests.