cockroach: github.com/cockroachdb/cockroach/pkg/server/heapprofiler Index | Files

package heapprofiler

import "github.com/cockroachdb/cockroach/pkg/server/heapprofiler"

Index

Package Files

cgoprofiler.go heapprofiler.go profiler_common.go profilestore.go statsprofiler.go

func SetJemallocHeapDumpFn Uses

func SetJemallocHeapDumpFn(fn func(filename string) error)

SetJemallocHeapDumpFn is used by the CLI package to inject the jemalloc heap collection function as a dependency. This is done here and not here so as to not impair the ability to run `go test` on the server package and sub-packages (Jemalloc needs custom link flags).

type HeapProfiler Uses

type HeapProfiler struct {
    // contains filtered or unexported fields
}

HeapProfiler is used to take Go heap profiles.

MaybeTakeProfile() is supposed to be called periodically. A profile is taken every time Go heap allocated bytes exceeds the previous high-water mark. The recorded high-water mark is also reset periodically, so that we take some profiles periodically. Profiles are also GCed periodically. The latest is always kept, and a couple of the ones with the largest heap are also kept.

func NewHeapProfiler Uses

func NewHeapProfiler(ctx context.Context, dir string, st *cluster.Settings) (*HeapProfiler, error)

NewHeapProfiler creates a HeapProfiler. dir is the directory in which profiles are to be stored.

func (*HeapProfiler) MaybeTakeProfile Uses

func (o *HeapProfiler) MaybeTakeProfile(ctx context.Context, curHeap int64)

MaybeTakeProfile takes a heap profile if the heap is big enough.

type NonGoAllocProfiler Uses

type NonGoAllocProfiler struct {
    // contains filtered or unexported fields
}

NonGoAllocProfiler is used to take heap profiles for allocations performed outside of Go.

MaybeTakeProfile() is supposed to be called periodically. A profile is taken every time Non-Go allocated bytes exceeds the previous high-water mark. The recorded high-water mark is also reset periodically, so that we take some profiles periodically. Profiles are also GCed periodically. The latest is always kept, and a couple of the ones with the largest heap are also kept.

func NewNonGoAllocProfiler Uses

func NewNonGoAllocProfiler(
    ctx context.Context, dir string, st *cluster.Settings,
) (*NonGoAllocProfiler, error)

NewNonGoAllocProfiler creates a NonGoAllocProfiler. dir is the directory in which profiles are to be stored.

func (*NonGoAllocProfiler) MaybeTakeProfile Uses

func (o *NonGoAllocProfiler) MaybeTakeProfile(ctx context.Context, curNonGoAlloc int64)

MaybeTakeProfile takes a profile if the non-go size is big enough.

type StatsProfiler Uses

type StatsProfiler struct {
    // contains filtered or unexported fields
}

StatsProfiler is used to take snapshots of the overall memory statistics to break down overall RSS memory usage.

MaybeTakeProfile() is supposed to be called periodically. A profile is taken every time RSS bytes exceeds the previous high-water mark. The recorded high-water mark is also reset periodically, so that we take some profiles periodically. Profiles are also GCed periodically. The latest is always kept, and a couple of the ones with the largest heap are also kept.

func NewStatsProfiler Uses

func NewStatsProfiler(
    ctx context.Context, dir string, st *cluster.Settings,
) (*StatsProfiler, error)

NewStatsProfiler creates a StatsProfiler. dir is the directory in which profiles are to be stored.

func (*StatsProfiler) MaybeTakeProfile Uses

func (o *StatsProfiler) MaybeTakeProfile(
    ctx context.Context, curRSS int64, ms *status.GoMemStats, cs *status.CGoMemStats,
)

MaybeTakeProfile takes a profile if the non-go size is big enough.

Package heapprofiler imports 17 packages (graph) and is imported by 6 packages. Updated 2020-08-13. Refresh now. Tools for package owners.