copy

package
v0.0.0-...-eace9c9 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlignToPage

func AlignToPage(size uint64) uint64

AlignToPage aligns a value to page boundary

func CopyMemoryToMmap

func CopyMemoryToMmap(pid int, srcAddr uintptr, size uint64, mmapPtr unsafe.Pointer) error

CopyMemoryToMmap copies memory from a process to mmap using ProcessVMReadv

func GetPageSize

func GetPageSize() int

GetPageSize returns the system page size

Types

type PageMap

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

PageMap represents the soft-dirty view of pages (imported from proc package)

func NewPageMap

func NewPageMap(pid int) *PageMap

NewPageMap creates a new PageMap for the given process

func (*PageMap) CalculateDirtyRatio

func (pm *PageMap) CalculateDirtyRatio(vmas []VMA) (float64, error)

CalculateDirtyRatio calculates the ratio of dirty pages

func (*PageMap) ClearSoftDirty

func (pm *PageMap) ClearSoftDirty() error

ClearSoftDirty clears the soft-dirty bits for the process

func (*PageMap) GetDirtyPages

func (pm *PageMap) GetDirtyPages(vmas []VMA) (map[uintptr]*VMA, error)

GetDirtyPages reads the pagemap to find dirty pages

type Perm

type Perm uint8

Perm represents memory permissions

const (
	PermRead  Perm = 1 << 0
	PermWrite Perm = 1 << 1
	PermExec  Perm = 1 << 2
)

type PreCopyEngine

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

PreCopyEngine handles iterative pre-copy with soft-dirty tracking

func NewPreCopyEngine

func NewPreCopyEngine(pid int, maxPasses int, dirtyThreshold float64, workers int, bufferManager *buffer.Manager, verbose bool) *PreCopyEngine

NewPreCopyEngine creates a new pre-copy engine

func (*PreCopyEngine) RunPreCopy

func (pce *PreCopyEngine) RunPreCopy(vmas []VMA) (*PreCopyResult, error)

RunPreCopy runs the iterative pre-copy process

type PreCopyResult

type PreCopyResult struct {
	Passes          int
	TotalTime       time.Duration
	FinalDirtyRatio float64
	VMAs            []VMA
	DirtyPages      map[uintptr]*VMA
}

PreCopyResult contains the result of pre-copy

type VMA

type VMA struct {
	Start  uintptr
	End    uintptr
	Size   uint64
	Perms  Perm
	IsZero bool // True if this VMA should be zero-filled (no permissions)

}

VMA represents a virtual memory area

Jump to

Keyboard shortcuts

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