profiletools

package module
v0.0.0-...-ea548b3 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 9 Imported by: 2

Documentation ¶

Index ¶

Constants ¶

This section is empty.

Variables ¶

This section is empty.

Functions ¶

This section is empty.

Types ¶

type EnvProfileOption ¶

type EnvProfileOption func(opts internalOptions)

func NoShutdownHook ¶

func NoShutdownHook() EnvProfileOption

type EnvProfiler ¶

type EnvProfiler interface {
	Stop()
}

func EnvProfile ¶

func EnvProfile(envPrefix string, opts ...EnvProfileOption) EnvProfiler

EnvProfile starts a profile based on environment variables.

Expected env vars are prefixed with envPrefix. Env vars used:

  • PROFILE: (cpu|block|mem|trace)
  • PROFILE_PATH: save profiles to this path, instead of OS temp dir
  • PROFILE_RATE: if using cpu, passed to runtime.SetCPUProfileRate(). if using "block", passed to runtime.SetBlockProfileRate()
  • PROFILE_QUIET: if not empty, no messages are logged to stderr.

You MUST call Stop() on the returned value when done, even if no profile was started:

defer EnvProfile("MYAPP_").Stop()

--

Jump to

Keyboard shortcuts

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