tree

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLength        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflow          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group")
)
View Source
var DefaultSampleTypeMapping = map[string]*SampleTypeConfig{
	"samples": {
		DisplayName: "cpu",
		Units:       "samples",
		Sampled:     true,
	},
	"inuse_objects": {
		Units:       "objects",
		Aggregation: "avg",
	},
	"alloc_objects": {
		Units:      "objects",
		Cumulative: true,
	},
	"inuse_space": {
		Units:       "bytes",
		Aggregation: "avg",
	},
	"alloc_space": {
		Units:      "bytes",
		Cumulative: true,
	},
}
View Source
var File_profile_proto protoreflect.FileDescriptor

Functions

func CombineTree added in v0.0.38

func CombineTree(leftTree, rightTree *Tree) (*Tree, *Tree)

CombineTree aligns 2 trees by making them having the same structure with the same number of nodes TODO: create a new struct?

func FindFunctionName added in v0.3.0

func FindFunctionName(x *Profile, locID uint64) (string, bool)

Types

type Finder added in v0.6.0

type Finder interface {
	FunctionFinder
	LocationFinder
}

func NewFinder added in v0.6.0

func NewFinder(p *Profile) Finder

NewFinder creates an efficient finder for functions or locations in a profile.

It exists to abstract the details of how functions and locations exist in a pprof profile, and make it easy to provide an efficient implementation depending on the actual profile format, as location and function finding is a recurrent operation while processing pprof profiles.

The [pprof format description](https://github.com/google/pprof/tree/master/proto#general-structure-of-a-profile) describes that both locations and functions have unique nonzero ids. A [comment in the proto file](https://github.com/google/pprof/blob/master/proto/profile.proto#L164-L166) goes further: _A profile could use instruction addresses or any integer sequence as ids_.

Based on this, any uint64 value (except 0) can appear as ids, and a map based cache can be used in that case. In practice, [go runtime](https://github.com/golang/go/blob/master/src/runtime/pprof/proto.go#L537) generates profiles where locations and functions use consecutive IDs starting from 1, making optimized access possible.

Taking advantage of this, the finder will try to:

  • Use direct access to functions and locations indexed by IDs when possible (sorting location and function sequences if needed).
  • Use a map based cache otherwise.

type Flamebearer

type Flamebearer struct {
	Names    []string `json:"names"`
	Levels   [][]int  `json:"levels"`
	NumTicks int      `json:"numTicks"`
	MaxSelf  int      `json:"maxSelf"`
	// TODO: see note in render.go
	SpyName    string `json:"spyName"`
	SampleRate uint32 `json:"sampleRate"`
	Units      string `json:"units"`
	Format     Format `json:"format"`
}

func CombineToFlamebearerStruct added in v0.0.38

func CombineToFlamebearerStruct(leftTree, rightTree *Tree, maxNodes int) *Flamebearer

CombineToFlamebearerStruct generates the Flamebearer struct from 2 trees. They must be the response trees from CombineTree (i.e. all children nodes must be the same length). The Flamebearer struct returned from this function is different to the one returned from Tree.FlamebearerStruct(). It has the following structure:

i+0 = x offset, left  tree
i+1 = total   , left  tree
i+2 = self    , left  tree
i+3 = x offset, right tree
i+4 = total   , right tree
i+5 = self    , right tree
i+6 = index in the names array

type Format added in v0.0.38

type Format string
const (
	FormatSingle Format = "single"
	FormatDouble Format = "double"
)

type Function added in v0.3.0

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 FindFunction added in v0.3.0

func FindFunction(x *Profile, fid uint64) (*Function, bool)

func (*Function) Descriptor deprecated added in v0.3.0

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

Deprecated: Use Function.ProtoReflect.Descriptor instead.

func (*Function) GetFilename added in v0.3.0

func (x *Function) GetFilename() int64

func (*Function) GetId added in v0.3.0

func (x *Function) GetId() uint64

func (*Function) GetName added in v0.3.0

func (x *Function) GetName() int64

func (*Function) GetStartLine added in v0.3.0

func (x *Function) GetStartLine() int64

func (*Function) GetSystemName added in v0.3.0

func (x *Function) GetSystemName() int64

func (*Function) MarshalToSizedBufferVT added in v0.7.0

func (m *Function) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Function) MarshalToVT added in v0.7.0

func (m *Function) MarshalToVT(dAtA []byte) (int, error)

func (*Function) MarshalVT added in v0.7.0

func (m *Function) MarshalVT() (dAtA []byte, err error)

func (*Function) ProtoMessage added in v0.3.0

func (*Function) ProtoMessage()

func (*Function) ProtoReflect added in v0.3.0

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

func (*Function) Reset added in v0.3.0

func (x *Function) Reset()

func (*Function) SizeVT added in v0.7.0

func (m *Function) SizeVT() (n int)

func (*Function) String added in v0.3.0

func (x *Function) String() string

func (*Function) UnmarshalVT added in v0.7.0

func (m *Function) UnmarshalVT(dAtA []byte) error

type FunctionFinder added in v0.6.0

type FunctionFinder interface {
	FindFunction(id uint64) (*Function, bool)
}

Find function in a profile based on its ID

type Label added in v0.3.0

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 added in v0.3.0

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

Deprecated: Use Label.ProtoReflect.Descriptor instead.

func (*Label) GetKey added in v0.3.0

func (x *Label) GetKey() int64

func (*Label) GetNum added in v0.3.0

func (x *Label) GetNum() int64

func (*Label) GetNumUnit added in v0.3.0

func (x *Label) GetNumUnit() int64

func (*Label) GetStr added in v0.3.0

func (x *Label) GetStr() int64

func (*Label) MarshalToSizedBufferVT added in v0.7.0

func (m *Label) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Label) MarshalToVT added in v0.7.0

func (m *Label) MarshalToVT(dAtA []byte) (int, error)

func (*Label) MarshalVT added in v0.7.0

func (m *Label) MarshalVT() (dAtA []byte, err error)

func (*Label) ProtoMessage added in v0.3.0

func (*Label) ProtoMessage()

func (*Label) ProtoReflect added in v0.3.0

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

func (*Label) Reset added in v0.3.0

func (x *Label) Reset()

func (*Label) SizeVT added in v0.7.0

func (m *Label) SizeVT() (n int)

func (*Label) String added in v0.3.0

func (x *Label) String() string

func (*Label) UnmarshalVT added in v0.7.0

func (m *Label) UnmarshalVT(dAtA []byte) error

type Labels added in v0.7.0

type Labels []*Label

func (Labels) Hash added in v0.7.0

func (l Labels) Hash() uint64

type Line added in v0.3.0

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 added in v0.3.0

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

Deprecated: Use Line.ProtoReflect.Descriptor instead.

func (*Line) GetFunctionId added in v0.3.0

func (x *Line) GetFunctionId() uint64

func (*Line) GetLine added in v0.3.0

func (x *Line) GetLine() int64

func (*Line) MarshalToSizedBufferVT added in v0.7.0

func (m *Line) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Line) MarshalToVT added in v0.7.0

func (m *Line) MarshalToVT(dAtA []byte) (int, error)

func (*Line) MarshalVT added in v0.7.0

func (m *Line) MarshalVT() (dAtA []byte, err error)

func (*Line) ProtoMessage added in v0.3.0

func (*Line) ProtoMessage()

func (*Line) ProtoReflect added in v0.3.0

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

func (*Line) Reset added in v0.3.0

func (x *Line) Reset()

func (*Line) SizeVT added in v0.7.0

func (m *Line) SizeVT() (n int)

func (*Line) String added in v0.3.0

func (x *Line) String() string

func (*Line) UnmarshalVT added in v0.7.0

func (m *Line) UnmarshalVT(dAtA []byte) error

type Location added in v0.3.0

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 FindLocation added in v0.3.0

func FindLocation(x *Profile, lid uint64) (*Location, bool)

func (*Location) Descriptor deprecated added in v0.3.0

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

Deprecated: Use Location.ProtoReflect.Descriptor instead.

func (*Location) GetAddress added in v0.3.0

func (x *Location) GetAddress() uint64

func (*Location) GetId added in v0.3.0

func (x *Location) GetId() uint64

func (*Location) GetIsFolded added in v0.3.0

func (x *Location) GetIsFolded() bool

func (*Location) GetLine added in v0.3.0

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

func (*Location) GetMappingId added in v0.3.0

func (x *Location) GetMappingId() uint64

func (*Location) MarshalToSizedBufferVT added in v0.7.0

func (m *Location) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Location) MarshalToVT added in v0.7.0

func (m *Location) MarshalToVT(dAtA []byte) (int, error)

func (*Location) MarshalVT added in v0.7.0

func (m *Location) MarshalVT() (dAtA []byte, err error)

func (*Location) ProtoMessage added in v0.3.0

func (*Location) ProtoMessage()

func (*Location) ProtoReflect added in v0.3.0

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

func (*Location) Reset added in v0.3.0

func (x *Location) Reset()

func (*Location) SizeVT added in v0.7.0

func (m *Location) SizeVT() (n int)

func (*Location) String added in v0.3.0

func (x *Location) String() string

func (*Location) UnmarshalVT added in v0.7.0

func (m *Location) UnmarshalVT(dAtA []byte) error

type LocationFinder added in v0.6.0

type LocationFinder interface {
	FindLocation(id uint64) (*Location, bool)
}

Find location in a profile based on its ID

type Mapping added in v0.3.0

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 added in v0.3.0

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

Deprecated: Use Mapping.ProtoReflect.Descriptor instead.

func (*Mapping) GetBuildId added in v0.3.0

func (x *Mapping) GetBuildId() int64

func (*Mapping) GetFileOffset added in v0.3.0

func (x *Mapping) GetFileOffset() uint64

func (*Mapping) GetFilename added in v0.3.0

func (x *Mapping) GetFilename() int64

func (*Mapping) GetHasFilenames added in v0.3.0

func (x *Mapping) GetHasFilenames() bool

func (*Mapping) GetHasFunctions added in v0.3.0

func (x *Mapping) GetHasFunctions() bool

func (*Mapping) GetHasInlineFrames added in v0.3.0

func (x *Mapping) GetHasInlineFrames() bool

func (*Mapping) GetHasLineNumbers added in v0.3.0

func (x *Mapping) GetHasLineNumbers() bool

func (*Mapping) GetId added in v0.3.0

func (x *Mapping) GetId() uint64

func (*Mapping) GetMemoryLimit added in v0.3.0

func (x *Mapping) GetMemoryLimit() uint64

func (*Mapping) GetMemoryStart added in v0.3.0

func (x *Mapping) GetMemoryStart() uint64

func (*Mapping) MarshalToSizedBufferVT added in v0.7.0

func (m *Mapping) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Mapping) MarshalToVT added in v0.7.0

func (m *Mapping) MarshalToVT(dAtA []byte) (int, error)

func (*Mapping) MarshalVT added in v0.7.0

func (m *Mapping) MarshalVT() (dAtA []byte, err error)

func (*Mapping) ProtoMessage added in v0.3.0

func (*Mapping) ProtoMessage()

func (*Mapping) ProtoReflect added in v0.3.0

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

func (*Mapping) Reset added in v0.3.0

func (x *Mapping) Reset()

func (*Mapping) SizeVT added in v0.7.0

func (m *Mapping) SizeVT() (n int)

func (*Mapping) String added in v0.3.0

func (x *Mapping) String() string

func (*Mapping) UnmarshalVT added in v0.7.0

func (m *Mapping) UnmarshalVT(dAtA []byte) error

type PprofMetadata added in v0.3.0

type PprofMetadata struct {
	Type      string
	Unit      string
	StartTime time.Time
	Duration  time.Duration
}

type Profile added in v0.3.0

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"`
	// Useful program location
	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_functions.
	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 ocurrences.
	// 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"`
	// Freeform text associated to the profile.
	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 ProfileFromVTPool added in v0.7.0

func ProfileFromVTPool() *Profile

func (*Profile) Descriptor deprecated added in v0.3.0

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

Deprecated: Use Profile.ProtoReflect.Descriptor instead.

func (*Profile) Get added in v0.3.0

func (x *Profile) Get(sampleType string, cb func(labels *spy.Labels, name []byte, val int)) error

func (*Profile) GetComment added in v0.3.0

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

func (*Profile) GetDefaultSampleType added in v0.3.0

func (x *Profile) GetDefaultSampleType() int64

func (*Profile) GetDropFrames added in v0.3.0

func (x *Profile) GetDropFrames() int64

func (*Profile) GetDurationNanos added in v0.3.0

func (x *Profile) GetDurationNanos() int64

func (*Profile) GetFunction added in v0.3.0

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

func (*Profile) GetKeepFrames added in v0.3.0

func (x *Profile) GetKeepFrames() int64

func (*Profile) GetLocation added in v0.3.0

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

func (*Profile) GetMapping added in v0.3.0

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

func (*Profile) GetPeriod added in v0.3.0

func (x *Profile) GetPeriod() int64

func (*Profile) GetPeriodType added in v0.3.0

func (x *Profile) GetPeriodType() *ValueType

func (*Profile) GetSample added in v0.3.0

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

func (*Profile) GetSampleType added in v0.3.0

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

func (*Profile) GetStringTable added in v0.3.0

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

func (*Profile) GetTimeNanos added in v0.3.0

func (x *Profile) GetTimeNanos() int64

func (*Profile) MarshalToSizedBufferVT added in v0.7.0

func (m *Profile) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Profile) MarshalToVT added in v0.7.0

func (m *Profile) MarshalToVT(dAtA []byte) (int, error)

func (*Profile) MarshalVT added in v0.7.0

func (m *Profile) MarshalVT() (dAtA []byte, err error)

func (*Profile) ProtoMessage added in v0.3.0

func (*Profile) ProtoMessage()

func (*Profile) ProtoReflect added in v0.3.0

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

func (*Profile) Reset added in v0.3.0

func (x *Profile) Reset()

func (*Profile) ResetVT added in v0.7.0

func (m *Profile) ResetVT()

func (*Profile) ResolveLabels added in v0.7.0

func (x *Profile) ResolveLabels(l Labels) map[string]string

func (*Profile) ResolveSampleType added in v0.7.0

func (x *Profile) ResolveSampleType(v int64) (*ValueType, bool)

func (*Profile) ReturnToVTPool added in v0.7.0

func (m *Profile) ReturnToVTPool()

func (*Profile) SampleTypes added in v0.3.0

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

func (*Profile) SizeVT added in v0.7.0

func (m *Profile) SizeVT() (n int)

func (*Profile) String added in v0.3.0

func (x *Profile) String() string

func (*Profile) UnmarshalVT added in v0.7.0

func (m *Profile) UnmarshalVT(dAtA []byte) error

type ProfileReader added in v0.7.0

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

func NewProfileReader added in v0.7.0

func NewProfileReader() *ProfileReader

func (*ProfileReader) Load added in v0.7.0

func (r *ProfileReader) Load(sampleType int64, labels Labels) (*Tree, bool)

func (*ProfileReader) Read added in v0.7.0

func (r *ProfileReader) Read(x *Profile, fn func(vt *ValueType, l Labels, t *Tree) (keep bool, err error)) error

func (*ProfileReader) Reset added in v0.7.0

func (r *ProfileReader) Reset()

func (*ProfileReader) SampleTypeFilter added in v0.7.0

func (r *ProfileReader) SampleTypeFilter(fn func(string) bool) *ProfileReader

type Sample added in v0.3.0

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
	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 added in v0.3.0

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

Deprecated: Use Sample.ProtoReflect.Descriptor instead.

func (*Sample) GetLabel added in v0.3.0

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

func (*Sample) GetLocationId added in v0.3.0

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

func (*Sample) GetValue added in v0.3.0

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

func (*Sample) MarshalToSizedBufferVT added in v0.7.0

func (m *Sample) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Sample) MarshalToVT added in v0.7.0

func (m *Sample) MarshalToVT(dAtA []byte) (int, error)

func (*Sample) MarshalVT added in v0.7.0

func (m *Sample) MarshalVT() (dAtA []byte, err error)

func (*Sample) ProtoMessage added in v0.3.0

func (*Sample) ProtoMessage()

func (*Sample) ProtoReflect added in v0.3.0

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

func (*Sample) Reset added in v0.3.0

func (x *Sample) Reset()

func (*Sample) SizeVT added in v0.7.0

func (m *Sample) SizeVT() (n int)

func (*Sample) String added in v0.3.0

func (x *Sample) String() string

func (*Sample) UnmarshalVT added in v0.7.0

func (m *Sample) UnmarshalVT(dAtA []byte) error

type SampleTypeConfig added in v0.6.0

type SampleTypeConfig struct {
	Units       string `json:"units,omitempty"`
	DisplayName string `json:"display-name,omitempty"`

	//  instant:    Aggregation:avg && !Cumulative && !Sampled
	//  cumulative: Aggregation:sum && Cumulative  && !Sampled
	//  delta:      Aggregation:sum && !Cumulative && Sampled
	Aggregation string `json:"aggregation,omitempty"`
	Cumulative  bool   `json:"cumulative,omitempty"`
	Sampled     bool   `json:"sampled,omitempty"`
}

TODO: dedup this with the version in scrape package

type Tree

type Tree struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func Deserialize

func Deserialize(d *dict.Dict, r io.Reader) (*Tree, error)

func DeserializeNoDict

func DeserializeNoDict(r io.Reader) (*Tree, error)

func FromBytes

func FromBytes(d *dict.Dict, p []byte) (*Tree, error)

func New

func New() *Tree

func (*Tree) Bytes

func (t *Tree) Bytes(d *dict.Dict, maxNodes int) ([]byte, error)

func (*Tree) Clone

func (t *Tree) Clone(r *big.Rat) *Tree

func (*Tree) Collapsed added in v0.3.0

func (t *Tree) Collapsed() string

func (*Tree) Diff added in v0.7.0

func (t *Tree) Diff(x *Tree) *Tree

func (*Tree) FlamebearerStruct

func (t *Tree) FlamebearerStruct(maxNodes int) *Flamebearer

func (*Tree) Insert

func (t *Tree) Insert(key []byte, value uint64)

func (*Tree) InsertInt added in v0.0.40

func (t *Tree) InsertInt(key []byte, value int)

func (*Tree) InsertStack added in v0.7.0

func (t *Tree) InsertStack(stack [][]byte, v uint64)

func (*Tree) InsertStackString added in v0.7.0

func (t *Tree) InsertStackString(stack []string, v uint64)

func (*Tree) Iterate added in v0.0.37

func (t *Tree) Iterate(cb func(key []byte, val uint64))

func (*Tree) IterateStacks added in v0.3.0

func (t *Tree) IterateStacks(cb func(name string, self uint64, stack []string))

func (*Tree) MarshalJSON

func (t *Tree) MarshalJSON() ([]byte, error)

func (*Tree) Merge

func (t *Tree) Merge(srcTrieI merge.Merger)

func (*Tree) Pprof added in v0.3.0

func (t *Tree) Pprof(metadata *PprofMetadata) *Profile

func (*Tree) Samples

func (t *Tree) Samples() uint64

func (*Tree) Serialize

func (t *Tree) Serialize(d *dict.Dict, maxNodes int, w io.Writer) error

func (*Tree) SerializeNoDict

func (t *Tree) SerializeNoDict(maxNodes int, w io.Writer) error

func (*Tree) SerializeTruncate added in v0.0.40

func (t *Tree) SerializeTruncate(d *dict.Dict, maxNodes int, w io.Writer) error

func (*Tree) String

func (t *Tree) String() string

type ValueType added in v0.3.0

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 added in v0.3.0

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

Deprecated: Use ValueType.ProtoReflect.Descriptor instead.

func (*ValueType) GetType added in v0.3.0

func (x *ValueType) GetType() int64

func (*ValueType) GetUnit added in v0.3.0

func (x *ValueType) GetUnit() int64

func (*ValueType) MarshalToSizedBufferVT added in v0.7.0

func (m *ValueType) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ValueType) MarshalToVT added in v0.7.0

func (m *ValueType) MarshalToVT(dAtA []byte) (int, error)

func (*ValueType) MarshalVT added in v0.7.0

func (m *ValueType) MarshalVT() (dAtA []byte, err error)

func (*ValueType) ProtoMessage added in v0.3.0

func (*ValueType) ProtoMessage()

func (*ValueType) ProtoReflect added in v0.3.0

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

func (*ValueType) Reset added in v0.3.0

func (x *ValueType) Reset()

func (*ValueType) SizeVT added in v0.7.0

func (m *ValueType) SizeVT() (n int)

func (*ValueType) String added in v0.3.0

func (x *ValueType) String() string

func (*ValueType) UnmarshalVT added in v0.7.0

func (m *ValueType) UnmarshalVT(dAtA []byte) error

Jump to

Keyboard shortcuts

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