crit

package
v6.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	StatsDump    = "stats-dump"
	StatsRestore = "stats-restore"
)

Variables

This section is empty.

Functions

func GetDumpStats added in v6.1.0

func GetDumpStats(dir string) (*images.DumpStatsEntry, error)

GetDumpStats returns the dump statistics of a checkpoint. dir is the path to the directory with the checkpoint images.

func GetRestoreStats added in v6.1.0

func GetRestoreStats(dir string) (*images.RestoreStatsEntry, error)

GetRestoreStats returns the restore statistics of a checkpoint. dir is the path to the directory with the checkpoint images.

Types

type CritSvc

type CritSvc interface {
	// Read binary image file into Go struct (decode.go)
	Decode() (*CriuImage, error)
	// Read only counts of image file entries into Go struct
	Info() (*CriuImage, error)
	// Read JSON into Go struct
	Parse() (*CriuImage, error)
	// Write JSON to binary image file (encode.go)
	Encode(*CriuImage) error
	// Explore process information (explore.go)
	ExplorePs() (*PsTree, error)
	ExploreFds() ([]*Fd, error)
	ExploreMems() ([]*MemMap, error)
	ExploreRss() ([]*RssMap, error)
}

CritSvc is the interface that wraps all CRIT operations. To create a CRIT service instance, use New().

func New

func New(
	inputFilePath, outputFilePath,
	inputDirPath string,
	pretty, noPayload bool,
) CritSvc

New creates a CRIT service to use in a Go program

func NewCli

func NewCli(
	inputFilePath, outputFilePath,
	inputDirPath string,
	pretty, noPayload bool,
) CritSvc

NewCli creates a CRIT service to use in a CLI app. All functions called by this service will wait for input from stdin if an input path is not provided.

type CriuEntry

type CriuEntry struct {
	proto.Message
	Extra string
}

CriuEntry represents a single entry in an image

func (*CriuEntry) MarshalJSON

func (c *CriuEntry) MarshalJSON() ([]byte, error)

MarshalJSON is the marshaler for CriuEntry. This is required as protojson.Marshal is used for the proto.Message, and any extra data is manually appended to the entry

type CriuImage

type CriuImage struct {
	Magic   string       `json:"magic"`
	Entries []*CriuEntry `json:"entries"`
}

CriuImage represents a CRIU binary image file

func (*CriuImage) UnmarshalJSON

func (img *CriuImage) UnmarshalJSON(data []byte) error

UnmarshalJSON is the unmarshaler for CriuImage. This is required as the object must be checked for any extra data, which must be removed from the JSON byte stream before unmarshaling the remaining bytes into a proto.Message object

type Fd

type Fd struct {
	PId   uint32  `json:"pId"`
	Files []*File `json:"files,omitempty"`
}

Fd represents the file descriptors opened in a single process

type File

type File struct {
	Fd   string `json:"fd"`
	Path string `json:"path"`
}

File represents a single opened file

type Mem

type Mem struct {
	Start      string `json:"start"`
	End        string `json:"end"`
	Protection string `json:"protection"`
	Resource   string `json:"resource,omitempty"`
}

Mem represents the memory mapping of a single file

type MemMap

type MemMap struct {
	PId  uint32 `json:"pId"`
	Exe  string `json:"exe"`
	Mems []*Mem `json:"mems,omitempty"`
}

MemMap represents the memory mapping of a single process

type PsTree

type PsTree struct {
	PId      uint32              `json:"pId"`
	PgId     uint32              `json:"pgId"`
	SId      uint32              `json:"sId"`
	Comm     string              `json:"comm"`
	Process  *images.PstreeEntry `json:"-"`
	Core     *images.CoreEntry   `json:"-"`
	Children []*PsTree           `json:"children,omitempty"`
}

PsTree represents the process tree

type Rss

type Rss struct {
	PhyAddr  string `json:"phyAddr,omitempty"`
	PhyPages int64  `json:"phyPages,omitempty"`
	Vmas     []*Vma `json:"vmas,omitempty"`
	Resource string `json:"resource,omitempty"`
}

Rss represents a single resident set size mapping

type RssMap

type RssMap struct {
	PId uint32 `json:"pId"`
	/*
		walrus -> walruses
		radius -> radii
		If you code without breaks,
		rss -> rsi :P
	*/
	Rsses []*Rss `json:"rss,omitempty"`
}

RssMap represents the resident set size mapping of a single process

type Vma

type Vma struct {
	Addr  string `json:"addr,omitempty"`
	Pages int64  `json:"pages,omitempty"`
}

Vma represents a single virtual memory area

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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