mon

package
v0.0.0-...-d94915d Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryAccount

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

MemoryAccount tracks the cumulated allocations for one client of MemoryUsageMonitor. This allows a client to release all the memory at once when it completes its work.

type MemoryUsageMonitor

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

MemoryUsageMonitor defines an object that can track and limit memory usage by other CockroachDB components.

This is currently used by the SQL session, see sql/session_mem_usage.go.

The monitor must be set up via StartMonitor/StopMonitor just before and after a processing context. The various counters express sizes in bytes.

func (*MemoryUsageMonitor) ClearAccount

func (mm *MemoryUsageMonitor) ClearAccount(ctx context.Context, acc *MemoryAccount)

ClearAccount releases all the cumulated allocations of an account at once and primes it for reuse.

func (*MemoryUsageMonitor) CloseAccount

func (mm *MemoryUsageMonitor) CloseAccount(ctx context.Context, acc *MemoryAccount)

CloseAccount releases all the cumulated allocations of an account at once.

func (*MemoryUsageMonitor) GrowAccount

func (mm *MemoryUsageMonitor) GrowAccount(
	ctx context.Context, acc *MemoryAccount, extraSize int64,
) error

GrowAccount requests a new allocation in an account.

func (*MemoryUsageMonitor) OpenAccount

func (mm *MemoryUsageMonitor) OpenAccount(_ context.Context, acc *MemoryAccount)

OpenAccount creates a new empty account.

func (*MemoryUsageMonitor) OpenAndInitAccount

func (mm *MemoryUsageMonitor) OpenAndInitAccount(
	ctx context.Context, acc *MemoryAccount, initialAllocation int64,
) error

OpenAndInitAccount creates a new account and pre-allocates some initial amount of memory.

func (*MemoryUsageMonitor) ResizeItem

func (mm *MemoryUsageMonitor) ResizeItem(
	ctx context.Context, acc *MemoryAccount, oldSize, newSize int64,
) error

ResizeItem requests a size change for an object already registered in an account. The reservation is not modified if the new allocation is refused, so that the caller can keep using the original item without an accounting error. This is better than calling ClearAccount then GrowAccount because if the Clear succeeds and the Grow fails the original item becomes invisible from the perspective of the monitor.

func (*MemoryUsageMonitor) StartMonitor

func (mm *MemoryUsageMonitor) StartMonitor()

StartMonitor begins a monitoring region.

func (*MemoryUsageMonitor) StopMonitor

func (mm *MemoryUsageMonitor) StopMonitor(ctx context.Context)

StopMonitor completes a monitoring region.

Jump to

Keyboard shortcuts

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