{"modulePath":"github.com/cloudzero/cloudzero-agent","version":"v1.3.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package profiling\n\nPackage profiling provides a self-contained pprof profiling server and periodic profile dump facility for CloudZero Agent components.\n\nUsage:\n\n\tstop := profiling.Start(profiling.Options{\n\t    Enabled:      true,\n\t    Port:         6060,\n\t    Dir:          \"/var/lib/agent/profiles\",\n\t    HeapInterval: 30 * time.Second,\n\t    CPUInterval:  5 * time.Minute,\n\t    CPUDuration:  30 * time.Second,\n\t})\n\tdefer stop()\n\nWhen Enabled is false, Start returns immediately with a no-op stop function and starts no goroutines or listeners.\n\n## Functions\n\n```go\nfunc Start(opts Options) (stop func())\n```\nStart launches the profiling subsystem according to opts and returns a stop function that shuts everything down cleanly.\n\nIf opts.Enabled is false, Start is a no-op and the returned function does nothing. No goroutines are started and no ports are opened.\n\n## Types\n\n```go\ntype Options struct {\n\t// Enabled is the master switch. Nothing runs unless this is true.\n\tEnabled bool\n\n\t// Port is the TCP port for the pprof HTTP server. Defaults to 6060 when zero.\n\tPort int\n\n\t// Dir is the output directory for periodic profile dumps. Heap and CPU dumps\n\t// are disabled when Dir is empty.\n\tDir string\n\n\t// HeapInterval is the interval between heap profile snapshots. Defaults to\n\t// 30 seconds when zero. Heap dumps are only written when Dir is set.\n\tHeapInterval time.Duration\n\n\t// CPUInterval is the interval between CPU capture sessions. CPU profiling is\n\t// disabled when CPUInterval is zero or Dir is empty.\n\tCPUInterval time.Duration\n\n\t// CPUDuration is the length of each CPU capture window. Defaults to 30 seconds\n\t// when zero (only meaningful when CPUInterval \u003e 0).\n\tCPUDuration time.Duration\n}\n```\nOptions configures the profiling server and periodic profile dumps.\n\n","path":"github.com/cloudzero/cloudzero-agent/app/profiling","name":"profiling","synopsis":"Package profiling provides a self-contained pprof profiling server and periodic profile dump facility for CloudZero Agent components.","isRedistributable":true}
