utils

package
v0.9.235 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: AGPL-3.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GpuControllerBinaryName = "gpucontroller"
	GpuControllerBinaryPath = "/usr/local/bin/cedana-gpu-controller"
	GpuSharedLibName        = "libcedana"
	GpuSharedLibPath        = "/usr/local/lib/libcedana-gpu.so"
)
View Source
const (
	DEFAULT_LOG_LEVEL    = zerolog.InfoLevel
	LOG_TIME_FORMAT_FULL = time.RFC3339
	LOG_CALLER_SKIP      = 3 // stack frame depth
)
View Source
const (
	TCP_ESTABLISHED = iota + 1
	TCP_SYN_SENT
	TCP_SYN_RECV
	TCP_FIN_WAIT1
	TCP_FIN_WAIT2
	TCP_TIME_WAIT
	TCP_CLOSE
	TCP_CLOSE_WAIT
	TCP_LAST_ACK
	TCP_LISTEN
	TCP_CLOSING
	TCP_NEW_SYN_RECV
)
View Source
const DefaultBufferSize = 4 * 1024 * 1024
View Source
const MaxNameLen = 4096
View Source
const (
	StorePath = "/var/lib/containers/storage/overlay-containers"
)

Variables

View Source
var (
	IDRegistryBkt      = []byte(idRegistryName)
	NameRegistryBkt    = []byte(nameRegistryName)
	CtrBkt             = []byte(ctrName)
	AllCtrsBkt         = []byte(allCtrsName)
	PodBkt             = []byte(podName)
	AllPodsBkt         = []byte(allPodsName)
	VolBkt             = []byte(volName)
	AllVolsBkt         = []byte(allVolsName)
	ExecBkt            = []byte(execName)
	AliasesBkt         = []byte(aliasesName)
	RuntimeConfigBkt   = []byte(runtimeConfigName)
	DependenciesBkt    = []byte(dependenciesName)
	VolDependenciesBkt = []byte(volCtrDependencies)
	NetworksBkt        = []byte(networksName)
	VolCtrsBkt         = []byte(volumeCtrsName)

	ExitCodeBkt          = []byte(exitCodeName)
	ExitCodeTimeStampBkt = []byte(exitCodeTimeStampName)

	ConfigKey     = []byte(configName)
	StateKey      = []byte(stateName)
	NetNSKey      = []byte(netNSName)
	ContainersBkt = []byte(containersName)
	PodIDKey      = []byte(podIDName)

	StaticDirKey   = []byte(staticDirName)
	TmpDirKey      = []byte(tmpDirName)
	RunRootKey     = []byte(runRootName)
	GraphRootKey   = []byte(graphRootName)
	GraphDriverKey = []byte(graphDriverName)
	OsKey          = []byte(osName)
	VolPathKey     = []byte(volPathName)
)
View Source
var File_profile_proto protoreflect.FileDescriptor

Functions

func CRImportCheckpoint

func CRImportCheckpoint(ctx context.Context, dir, containerId string) error

CRImportCheckpoint it the function which imports the information from checkpoint tarball and re-creates the container from that information

func CheckTCPConnections added in v0.9.228

func CheckTCPConnections(pid int32) (bool, error)

checks if the given process has any active tcp connections

func CombineContexts

func CombineContexts(ctx1, ctx2 context.Context) context.Context

Combine two contexts into one

func CopyFile

func CopyFile(src, dstFolder string) error

func CreateContainer

func CreateContainer(ctrState *map[string]interface{}, ctrConfig *types.ContainerConfig, db *DB, containerId string) error

func ExtractCID

func ExtractCID(vm string) (uint32, error)

func GenerateJWT

func GenerateJWT(id string, skey string) (*string, error)

func GetAllCtrsBucket

func GetAllCtrsBucket(tx *bolt.Tx) (*bolt.Bucket, error)

func GetConfig

func GetConfig() (*types.Config, error)

func GetCtrBucket

func GetCtrBucket(tx *bolt.Tx) (*bolt.Bucket, error)

func GetFreePort added in v0.9.230

func GetFreePort() (int, error)

GetFreePort returns a free random port on the host

func GetIDBucket

func GetIDBucket(tx *bolt.Tx) (*bolt.Bucket, error)

func GetMACAddress added in v0.9.225

func GetMACAddress() (string, error)

func GetMachineID

func GetMachineID() (string, error)

func GetNamesBucket

func GetNamesBucket(tx *bolt.Tx) (*bolt.Bucket, error)

func GetPid

func GetPid(processName string) (int32, error)

func GetProcessName

func GetProcessName(pid int32) (*string, error)

func GetProcessSimilarity

func GetProcessSimilarity(processName string, processes []*ps.Process) (int32, error)

func GetTCPStates

func GetTCPStates(reader io.Reader) ([]uint64, error)

func GetVolBucket

func GetVolBucket(tx *bolt.Tx) (*bolt.Bucket, error)

func InitConfig

func InitConfig(args types.InitConfigArgs) error

func InitOtel

func InitOtel(ctx context.Context, version string) (shutdown func(context.Context) error, err error)

setupOTelSDK bootstraps the OpenTelemetry pipeline. If it does not return an error, make sure to call shutdown for proper cleanup.

func InitOtelNoop added in v0.9.224

func InitOtelNoop()

func IsReadyLoop

func IsReadyLoop(getTCPStates func(io.Reader) ([]uint64, error), getTCPReader func() (io.Reader, error), IsUsingIoUring func(fdDir string) (bool, error), iteration int, timeoutInMs time.Duration, fdDir string) (bool, error)

func IsUsingIoUring

func IsUsingIoUring(fdDir string) (bool, error)

func JSONDeepCopy

func JSONDeepCopy(from, to interface{}) error

func NewFromFile

func NewFromFile(path string) (*rspec.Spec, envCache, error)

func NewFromTemplate

func NewFromTemplate(r io.Reader) (*rspec.Spec, envCache, error)

func PidExists added in v0.9.233

func PidExists(pid uint32) bool

func ReadJSONFile

func ReadJSONFile(v interface{}, dir, file string) (string, error)

func SendFile

func SendFile(socket *os.File, file *os.File) error

SendFile sends a file over the given AF_UNIX socket. file.Name() is also included so that if the other end uses RecvFile, the file will have the same name information.

func SendRawFd

func SendRawFd(socket *os.File, msg string, fd uintptr) error

SendRawFd sends a specific file descriptor over the given AF_UNIX socket.

func StartPprofServer

func StartPprofServer()

func TarFolder

func TarFolder(srcFolder, destTar string) error

func TarGzFolder

func TarGzFolder(srcFolder, destTar string) error

func TarLZ4Folder

func TarLZ4Folder(srcFolder, destTar string) error

func UntarFolder

func UntarFolder(srcTar, destFolder string) error

func UntarGzFolder

func UntarGzFolder(srcTarGz, destFolder string) error

func WaitForPid added in v0.9.228

func WaitForPid(pid int32) chan int

Returns a channel that will be closed when a non-child process exits Since, we cannot use the process.Wait() method to wait for a non-child process to exit

func WriteJSON

func WriteJSON(w io.Writer, v interface{}) error

WriteJSON writes the provided struct v to w using standard json marshaling without a trailing newline. This is used instead of json.Encoder because there might be a problem in json decoder in some cases, see: https://github.com/docker/docker/issues/14203#issuecomment-174177790

func WriteJSONFile

func WriteJSONFile(v interface{}, dir, file string) (string, error)

Types

type Criu

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

Code for interfacing with CRIU. We could use go-criu, but there are certain limitations in the abstractions presented. Most of the code found here is lifted from https://github.com/checkpoint-restore/go-criu/blob/master/main.go.

func MakeCriu

func MakeCriu() *Criu

func (*Criu) Cleanup

func (c *Criu) Cleanup()

Cleanup cleans up

func (*Criu) Dump

func (c *Criu) Dump(opts *rpc.CriuOpts, nfy *Notify) (*rpc.CriuResp, error)

Dump dumps a process

func (*Criu) GetCriuVersion

func (c *Criu) GetCriuVersion() (int, error)

func (*Criu) IsCriuAtLeast

func (c *Criu) IsCriuAtLeast(version int) (bool, error)

IsCriuAtLeast checks if the version is at least the same as the parameter version

func (*Criu) PreDump

func (c *Criu) PreDump(opts *rpc.CriuOpts, nfy *Notify) (*rpc.CriuResp, error)

PreDump does a pre-dump

func (*Criu) Prepare

func (c *Criu) Prepare() error

Prepare sets up everything for the RPC communication to CRIU

func (*Criu) Restore

func (c *Criu) Restore(opts *rpc.CriuOpts, nfy *Notify) (*rpc.CriuResp, error)

Restore restores a process

func (*Criu) SetCriuPath

func (c *Criu) SetCriuPath(path string)

type DB

type DB struct {
	Conn   *bolt.DB
	DbLock sync.Mutex
	DbPath string
}

func (*DB) GetContainerConfigFromDB

func (s *DB) GetContainerConfigFromDB(id []byte, config *map[string]interface{}, ctrsBkt *bolt.Bucket) error

func (*DB) GetContainerStateDB

func (s *DB) GetContainerStateDB(id []byte, state *map[string]interface{}, ctrsBkt *bolt.Bucket) error

func (*DB) SetNewDbConn

func (db *DB) SetNewDbConn() error

type Function

type Function struct {

	// Unique nonzero id for the function.
	Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// Name of the function, in human-readable form if available.
	Name int64 `protobuf:"varint,2,opt,name=name,proto3" json:"name,omitempty"` // Index into string table
	// Name of the function, as identified by the system.
	// For instance, it can be a C++ mangled name.
	SystemName int64 `protobuf:"varint,3,opt,name=system_name,json=systemName,proto3" json:"system_name,omitempty"` // Index into string table
	// Source file containing the function.
	Filename int64 `protobuf:"varint,4,opt,name=filename,proto3" json:"filename,omitempty"` // Index into string table
	// Line number in source file.
	StartLine int64 `protobuf:"varint,5,opt,name=start_line,json=startLine,proto3" json:"start_line,omitempty"`
	// contains filtered or unexported fields
}

func (*Function) Descriptor deprecated

func (*Function) Descriptor() ([]byte, []int)

Deprecated: Use Function.ProtoReflect.Descriptor instead.

func (*Function) GetFilename

func (x *Function) GetFilename() int64

func (*Function) GetId

func (x *Function) GetId() uint64

func (*Function) GetName

func (x *Function) GetName() int64

func (*Function) GetStartLine

func (x *Function) GetStartLine() int64

func (*Function) GetSystemName

func (x *Function) GetSystemName() int64

func (*Function) ProtoMessage

func (*Function) ProtoMessage()

func (*Function) ProtoReflect

func (x *Function) ProtoReflect() protoreflect.Message

func (*Function) Reset

func (x *Function) Reset()

func (*Function) String

func (x *Function) String() string

type Key added in v0.9.221

type Key int
const (
	CtsKey          Key = 100
	DumpStatsKey    Key = 101
	RestoreStatsKey Key = 102
)

type Label

type Label struct {
	Key int64 `protobuf:"varint,1,opt,name=key,proto3" json:"key,omitempty"` // Index into string table
	// At most one of the following must be present
	Str int64 `protobuf:"varint,2,opt,name=str,proto3" json:"str,omitempty"` // Index into string table
	Num int64 `protobuf:"varint,3,opt,name=num,proto3" json:"num,omitempty"`
	// Should only be present when num is present.
	// Specifies the units of num.
	// Use arbitrary string (for example, "requests") as a custom count unit.
	// If no unit is specified, consumer may apply heuristic to deduce the unit.
	// Consumers may also  interpret units like "bytes" and "kilobytes" as memory
	// units and units like "seconds" and "nanoseconds" as time units,
	// and apply appropriate unit conversions to these.
	NumUnit int64 `protobuf:"varint,4,opt,name=num_unit,json=numUnit,proto3" json:"num_unit,omitempty"` // Index into string table
	// contains filtered or unexported fields
}

func (*Label) Descriptor deprecated

func (*Label) Descriptor() ([]byte, []int)

Deprecated: Use Label.ProtoReflect.Descriptor instead.

func (*Label) GetKey

func (x *Label) GetKey() int64

func (*Label) GetNum

func (x *Label) GetNum() int64

func (*Label) GetNumUnit

func (x *Label) GetNumUnit() int64

func (*Label) GetStr

func (x *Label) GetStr() int64

func (*Label) ProtoMessage

func (*Label) ProtoMessage()

func (*Label) ProtoReflect

func (x *Label) ProtoReflect() protoreflect.Message

func (*Label) Reset

func (x *Label) Reset()

func (*Label) String

func (x *Label) String() string

type Line

type Line struct {

	// The id of the corresponding profile.Function for this line.
	FunctionId uint64 `protobuf:"varint,1,opt,name=function_id,json=functionId,proto3" json:"function_id,omitempty"`
	// Line number in source code.
	Line int64 `protobuf:"varint,2,opt,name=line,proto3" json:"line,omitempty"`
	// contains filtered or unexported fields
}

func (*Line) Descriptor deprecated

func (*Line) Descriptor() ([]byte, []int)

Deprecated: Use Line.ProtoReflect.Descriptor instead.

func (*Line) GetFunctionId

func (x *Line) GetFunctionId() uint64

func (*Line) GetLine

func (x *Line) GetLine() int64

func (*Line) ProtoMessage

func (*Line) ProtoMessage()

func (*Line) ProtoReflect

func (x *Line) ProtoReflect() protoreflect.Message

func (*Line) Reset

func (x *Line) Reset()

func (*Line) String

func (x *Line) String() string

type LineInfoHook

type LineInfoHook struct{}

func (LineInfoHook) Run

func (h LineInfoHook) Run(e *zerolog.Event, l zerolog.Level, msg string)

type Location

type Location struct {

	// Unique nonzero id for the location.  A profile could use
	// instruction addresses or any integer sequence as ids.
	Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// The id of the corresponding profile.Mapping for this location.
	// It can be unset if the mapping is unknown or not applicable for
	// this profile type.
	MappingId uint64 `protobuf:"varint,2,opt,name=mapping_id,json=mappingId,proto3" json:"mapping_id,omitempty"`
	// The instruction address for this location, if available.  It
	// should be within [Mapping.memory_start...Mapping.memory_limit]
	// for the corresponding mapping. A non-leaf address may be in the
	// middle of a call instruction. It is up to display tools to find
	// the beginning of the instruction if necessary.
	Address uint64 `protobuf:"varint,3,opt,name=address,proto3" json:"address,omitempty"`
	// Multiple line indicates this location has inlined functions,
	// where the last entry represents the caller into which the
	// preceding entries were inlined.
	//
	// E.g., if memcpy() is inlined into printf:
	//
	//	line[0].function_name == "memcpy"
	//	line[1].function_name == "printf"
	Line []*Line `protobuf:"bytes,4,rep,name=line,proto3" json:"line,omitempty"`
	// Provides an indication that multiple symbols map to this location's
	// address, for example due to identical code folding by the linker. In that
	// case the line information above represents one of the multiple
	// symbols. This field must be recomputed when the symbolization state of the
	// profile changes.
	IsFolded bool `protobuf:"varint,5,opt,name=is_folded,json=isFolded,proto3" json:"is_folded,omitempty"`
	// contains filtered or unexported fields
}

Describes function and line table debug information.

func (*Location) Descriptor deprecated

func (*Location) Descriptor() ([]byte, []int)

Deprecated: Use Location.ProtoReflect.Descriptor instead.

func (*Location) GetAddress

func (x *Location) GetAddress() uint64

func (*Location) GetId

func (x *Location) GetId() uint64

func (*Location) GetIsFolded

func (x *Location) GetIsFolded() bool

func (*Location) GetLine

func (x *Location) GetLine() []*Line

func (*Location) GetMappingId

func (x *Location) GetMappingId() uint64

func (*Location) ProtoMessage

func (*Location) ProtoMessage()

func (*Location) ProtoReflect

func (x *Location) ProtoReflect() protoreflect.Message

func (*Location) Reset

func (x *Location) Reset()

func (*Location) String

func (x *Location) String() string

type Mapping

type Mapping struct {

	// Unique nonzero id for the mapping.
	Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// Address at which the binary (or DLL) is loaded into memory.
	MemoryStart uint64 `protobuf:"varint,2,opt,name=memory_start,json=memoryStart,proto3" json:"memory_start,omitempty"`
	// The limit of the address range occupied by this mapping.
	MemoryLimit uint64 `protobuf:"varint,3,opt,name=memory_limit,json=memoryLimit,proto3" json:"memory_limit,omitempty"`
	// Offset in the binary that corresponds to the first mapped address.
	FileOffset uint64 `protobuf:"varint,4,opt,name=file_offset,json=fileOffset,proto3" json:"file_offset,omitempty"`
	// The object this entry is loaded from.  This can be a filename on
	// disk for the main binary and shared libraries, or virtual
	// abstractions like "[vdso]".
	Filename int64 `protobuf:"varint,5,opt,name=filename,proto3" json:"filename,omitempty"` // Index into string table
	// A string that uniquely identifies a particular program version
	// with high probability. E.g., for binaries generated by GNU tools,
	// it could be the contents of the .note.gnu.build-id field.
	BuildId int64 `protobuf:"varint,6,opt,name=build_id,json=buildId,proto3" json:"build_id,omitempty"` // Index into string table
	// The following fields indicate the resolution of symbolic info.
	HasFunctions    bool `protobuf:"varint,7,opt,name=has_functions,json=hasFunctions,proto3" json:"has_functions,omitempty"`
	HasFilenames    bool `protobuf:"varint,8,opt,name=has_filenames,json=hasFilenames,proto3" json:"has_filenames,omitempty"`
	HasLineNumbers  bool `protobuf:"varint,9,opt,name=has_line_numbers,json=hasLineNumbers,proto3" json:"has_line_numbers,omitempty"`
	HasInlineFrames bool `protobuf:"varint,10,opt,name=has_inline_frames,json=hasInlineFrames,proto3" json:"has_inline_frames,omitempty"`
	// contains filtered or unexported fields
}

func (*Mapping) Descriptor deprecated

func (*Mapping) Descriptor() ([]byte, []int)

Deprecated: Use Mapping.ProtoReflect.Descriptor instead.

func (*Mapping) GetBuildId

func (x *Mapping) GetBuildId() int64

func (*Mapping) GetFileOffset

func (x *Mapping) GetFileOffset() uint64

func (*Mapping) GetFilename

func (x *Mapping) GetFilename() int64

func (*Mapping) GetHasFilenames

func (x *Mapping) GetHasFilenames() bool

func (*Mapping) GetHasFunctions

func (x *Mapping) GetHasFunctions() bool

func (*Mapping) GetHasInlineFrames

func (x *Mapping) GetHasInlineFrames() bool

func (*Mapping) GetHasLineNumbers

func (x *Mapping) GetHasLineNumbers() bool

func (*Mapping) GetId

func (x *Mapping) GetId() uint64

func (*Mapping) GetMemoryLimit

func (x *Mapping) GetMemoryLimit() uint64

func (*Mapping) GetMemoryStart

func (x *Mapping) GetMemoryStart() uint64

func (*Mapping) ProtoMessage

func (*Mapping) ProtoMessage()

func (*Mapping) ProtoReflect

func (x *Mapping) ProtoReflect() protoreflect.Message

func (*Mapping) Reset

func (x *Mapping) Reset()

func (*Mapping) String

func (x *Mapping) String() string

type Notify

type Notify struct {
	Logger         *zerolog.Logger
	PreDumpFunc    NotifyFunc
	PostDumpFunc   NotifyFunc
	PreRestoreFunc NotifyFunc
	PreResumeFunc  NotifyFunc
}

func (Notify) NetworkLock

func (n Notify) NetworkLock() error

NetworkLock NoNotify

func (Notify) NetworkUnlock

func (n Notify) NetworkUnlock() error

NetworkUnlock NoNotify

func (Notify) PostDump

func (n Notify) PostDump() error

func (Notify) PostRestore

func (n Notify) PostRestore(pid int32) error

PostRestore NoNotify

func (Notify) PostResume

func (n Notify) PostResume() error

PostResume NoNotify

func (Notify) PostSetupNamespaces

func (n Notify) PostSetupNamespaces() error

PostSetupNamespaces NoNotify

func (Notify) PreDump

func (n Notify) PreDump() error

func (Notify) PreRestore

func (n Notify) PreRestore() error

func (Notify) PreResume

func (n Notify) PreResume() error

func (Notify) SetupNamespaces

func (n Notify) SetupNamespaces(pid int32) error

SetupNamespaces NoNotify

type NotifyFunc

type NotifyFunc struct {
	Avail    bool
	Callback func() error
}

type OperationType

type OperationType string
const (
	CriuCheckpointOp OperationType = "checkpoint"
	CriuRestoreOp    OperationType = "restore"
	CompressOp       OperationType = "compress"
	DecompressOp     OperationType = "decompress"
	UploadOp         OperationType = "upload"
	DownloadOp       OperationType = "download"
)

type Profile

type Profile struct {

	// A description of the samples associated with each Sample.value.
	// For a cpu profile this might be:
	//
	//	[["cpu","nanoseconds"]] or [["wall","seconds"]] or [["syscall","count"]]
	//
	// For a heap profile, this might be:
	//
	//	[["allocations","count"], ["space","bytes"]],
	//
	// If one of the values represents the number of events represented
	// by the sample, by convention it should be at index 0 and use
	// sample_type.unit == "count".
	SampleType []*ValueType `protobuf:"bytes,1,rep,name=sample_type,json=sampleType,proto3" json:"sample_type,omitempty"`
	// The set of samples recorded in this profile.
	Sample []*Sample `protobuf:"bytes,2,rep,name=sample,proto3" json:"sample,omitempty"`
	// Mapping from address ranges to the image/binary/library mapped
	// into that address range.  mapping[0] will be the main binary.
	Mapping []*Mapping `protobuf:"bytes,3,rep,name=mapping,proto3" json:"mapping,omitempty"`
	// Locations referenced by samples.
	Location []*Location `protobuf:"bytes,4,rep,name=location,proto3" json:"location,omitempty"`
	// Functions referenced by locations.
	Function []*Function `protobuf:"bytes,5,rep,name=function,proto3" json:"function,omitempty"`
	// A common table for strings referenced by various messages.
	// string_table[0] must always be "".
	StringTable []string `protobuf:"bytes,6,rep,name=string_table,json=stringTable,proto3" json:"string_table,omitempty"`
	// frames with Function.function_name fully matching the following
	// regexp will be dropped from the samples, along with their successors.
	DropFrames int64 `protobuf:"varint,7,opt,name=drop_frames,json=dropFrames,proto3" json:"drop_frames,omitempty"` // Index into string table.
	// frames with Function.function_name fully matching the following
	// regexp will be kept, even if it matches drop_frames.
	KeepFrames int64 `protobuf:"varint,8,opt,name=keep_frames,json=keepFrames,proto3" json:"keep_frames,omitempty"` // Index into string table.
	// Time of collection (UTC) represented as nanoseconds past the epoch.
	TimeNanos int64 `protobuf:"varint,9,opt,name=time_nanos,json=timeNanos,proto3" json:"time_nanos,omitempty"`
	// Duration of the profile, if a duration makes sense.
	DurationNanos int64 `protobuf:"varint,10,opt,name=duration_nanos,json=durationNanos,proto3" json:"duration_nanos,omitempty"`
	// The kind of events between sampled occurrences.
	// e.g [ "cpu","cycles" ] or [ "heap","bytes" ]
	PeriodType *ValueType `protobuf:"bytes,11,opt,name=period_type,json=periodType,proto3" json:"period_type,omitempty"`
	// The number of events between sampled occurrences.
	Period int64 `protobuf:"varint,12,opt,name=period,proto3" json:"period,omitempty"`
	// Free-form text associated with the profile. The text is displayed as is
	// to the user by the tools that read profiles (e.g. by pprof). This field
	// should not be used to store any machine-readable information, it is only
	// for human-friendly content. The profile must stay functional if this field
	// is cleaned.
	Comment []int64 `protobuf:"varint,13,rep,packed,name=comment,proto3" json:"comment,omitempty"` // Indices into string table.
	// Index into the string table of the type of the preferred sample
	// value. If unset, clients should default to the last sample value.
	DefaultSampleType int64 `protobuf:"varint,14,opt,name=default_sample_type,json=defaultSampleType,proto3" json:"default_sample_type,omitempty"`
	// contains filtered or unexported fields
}

func (*Profile) Descriptor deprecated

func (*Profile) Descriptor() ([]byte, []int)

Deprecated: Use Profile.ProtoReflect.Descriptor instead.

func (*Profile) GetComment

func (x *Profile) GetComment() []int64

func (*Profile) GetDefaultSampleType

func (x *Profile) GetDefaultSampleType() int64

func (*Profile) GetDropFrames

func (x *Profile) GetDropFrames() int64

func (*Profile) GetDurationNanos

func (x *Profile) GetDurationNanos() int64

func (*Profile) GetFunction

func (x *Profile) GetFunction() []*Function

func (*Profile) GetKeepFrames

func (x *Profile) GetKeepFrames() int64

func (*Profile) GetLocation

func (x *Profile) GetLocation() []*Location

func (*Profile) GetMapping

func (x *Profile) GetMapping() []*Mapping

func (*Profile) GetPeriod

func (x *Profile) GetPeriod() int64

func (*Profile) GetPeriodType

func (x *Profile) GetPeriodType() *ValueType

func (*Profile) GetSample

func (x *Profile) GetSample() []*Sample

func (*Profile) GetSampleType

func (x *Profile) GetSampleType() []*ValueType

func (*Profile) GetStringTable

func (x *Profile) GetStringTable() []string

func (*Profile) GetTimeNanos

func (x *Profile) GetTimeNanos() int64

func (*Profile) ProtoMessage

func (*Profile) ProtoMessage()

func (*Profile) ProtoReflect

func (x *Profile) ProtoReflect() protoreflect.Message

func (*Profile) Reset

func (x *Profile) Reset()

func (*Profile) String

func (x *Profile) String() string

type Sample

type Sample struct {

	// The ids recorded here correspond to a Profile.location.id.
	// The leaf is at location_id[0].
	LocationId []uint64 `protobuf:"varint,1,rep,packed,name=location_id,json=locationId,proto3" json:"location_id,omitempty"`
	// The type and unit of each value is defined by the corresponding
	// entry in Profile.sample_type. All samples must have the same
	// number of values, the same as the length of Profile.sample_type.
	// When aggregating multiple samples into a single sample, the
	// result has a list of values that is the element-wise sum of the
	// lists of the originals.
	Value []int64 `protobuf:"varint,2,rep,packed,name=value,proto3" json:"value,omitempty"`
	// label includes additional context for this sample. It can include
	// things like a thread id, allocation size, etc.
	//
	// NOTE: While possible, having multiple values for the same label key is
	// strongly discouraged and should never be used. Most tools (e.g. pprof) do
	// not have good (or any) support for multi-value labels. And an even more
	// discouraged case is having a string label and a numeric label of the same
	// name on a sample.  Again, possible to express, but should not be used.
	Label []*Label `protobuf:"bytes,3,rep,name=label,proto3" json:"label,omitempty"`
	// contains filtered or unexported fields
}

Each Sample records values encountered in some program context. The program context is typically a stack trace, perhaps augmented with auxiliary information like the thread-id, some indicator of a higher level request being handled etc.

func (*Sample) Descriptor deprecated

func (*Sample) Descriptor() ([]byte, []int)

Deprecated: Use Sample.ProtoReflect.Descriptor instead.

func (*Sample) GetLabel

func (x *Sample) GetLabel() []*Label

func (*Sample) GetLocationId

func (x *Sample) GetLocationId() []uint64

func (*Sample) GetValue

func (x *Sample) GetValue() []int64

func (*Sample) ProtoMessage

func (*Sample) ProtoMessage()

func (*Sample) ProtoReflect

func (x *Sample) ProtoReflect() protoreflect.Message

func (*Sample) Reset

func (x *Sample) Reset()

func (*Sample) String

func (x *Sample) String() string

type Timings

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

func NewTimings

func NewTimings() *Timings

func (*Timings) Flush

func (t *Timings) Flush() error

func (*Timings) Start

func (t *Timings) Start(name OperationType)

func (*Timings) Stop

func (t *Timings) Stop(name OperationType)

type ValueType

type ValueType struct {
	Type int64 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"` // Index into string table.
	Unit int64 `protobuf:"varint,2,opt,name=unit,proto3" json:"unit,omitempty"` // Index into string table.
	// contains filtered or unexported fields
}

ValueType describes the semantics and measurement units of a value.

func (*ValueType) Descriptor deprecated

func (*ValueType) Descriptor() ([]byte, []int)

Deprecated: Use ValueType.ProtoReflect.Descriptor instead.

func (*ValueType) GetType

func (x *ValueType) GetType() int64

func (*ValueType) GetUnit

func (x *ValueType) GetUnit() int64

func (*ValueType) ProtoMessage

func (*ValueType) ProtoMessage()

func (*ValueType) ProtoReflect

func (x *ValueType) ProtoReflect() protoreflect.Message

func (*ValueType) Reset

func (x *ValueType) Reset()

func (*ValueType) String

func (x *ValueType) String() string

Jump to

Keyboard shortcuts

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