tree

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSampleTypeMapping = map[string]*SampleTypeConfig{

	"samples": {
		DisplayName: "cpu",
		Units:       metadata.SamplesUnits,
		Sampled:     true,
	},
	"inuse_objects": {
		Units:       metadata.ObjectsUnits,
		Aggregation: metadata.AverageAggregationType,
	},
	"alloc_objects": {
		Units:      metadata.ObjectsUnits,
		Cumulative: true,
	},
	"inuse_space": {
		Units:       metadata.BytesUnits,
		Aggregation: metadata.AverageAggregationType,
	},
	"alloc_space": {
		Units:      metadata.BytesUnits,
		Cumulative: true,
	},
	"goroutine": {
		DisplayName: "goroutines",
		Units:       metadata.GoroutinesUnits,
		Aggregation: metadata.AverageAggregationType,
	},
	"contentions": {

		DisplayName: "mutex_count",
		Units:       metadata.LockSamplesUnits,
		Cumulative:  true,
	},
	"delay": {

		DisplayName: "mutex_duration",
		Units:       metadata.LockNanosecondsUnits,
		Cumulative:  true,
	},
}

DefaultSampleTypeMapping contains default settings for every supported pprof sample type. These settings are required to build a proper storage.PutInput payload.

TODO(kolesnikovae): We should find a way to eliminate collisions.

For example, both Go 'block' and 'mutex' profiles have
'contentions' and 'delay' sample types - this means we can't
override display name of the profile types and they would
be indistinguishable for the server.

The keys should have the following structure:
	{origin}.{profile_type}.{sample_type}

Example names (can be a reserved label, e.g __type__):
  * go.cpu.samples
  * go.block.delay
  * go.mutex.delay
  * nodejs.heap.objects

Another problem is that in pull mode we don't have spy-name, therefore we should solve this problem first.

Functions

func FindFunction

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

func FindFunctionName

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

func FindLocation

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

func Get added in v1.13.0

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

func SampleTypes added in v1.13.0

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

Types

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"`
}

type Format

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

type PprofMetadata

type PprofMetadata struct {
	Type       string
	Unit       string
	PeriodType string
	PeriodUnit string
	Period     int64
	StartTime  time.Time
	Duration   time.Duration
}

type SampleTypeConfig

type SampleTypeConfig struct {
	Units       metadata.Units           `json:"units,omitempty" yaml:"units,omitempty"`
	DisplayName string                   `json:"display-name,omitempty" yaml:"display-name,omitempty"`
	Aggregation metadata.AggregationType `json:"aggregation,omitempty" yaml:"aggregation,omitempty"`
	Cumulative  bool                     `json:"cumulative,omitempty" yaml:"cumulative,omitempty"`
	Sampled     bool                     `json:"sampled,omitempty" yaml:"sampled,omitempty"`
}

type StackBuilder

type StackBuilder interface {
	Push(frame []byte)
	Pop() // bool
	Build() (stackID uint64)
	Reset()
}

type Tree

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

func DeserializeNoDict

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

used in the cloud

func New

func New() *Tree

func (*Tree) Clone

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

func (*Tree) Collapsed

func (t *Tree) Collapsed() string

func (*Tree) Diff

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

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

func (*Tree) InsertStack

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

func (*Tree) InsertStackString

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

func (*Tree) Iterate

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

func (*Tree) IterateStacks

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

func (*Tree) IterateWithStackBuilder

func (t *Tree) IterateWithStackBuilder(sb StackBuilder, cb func(stackID uint64, val uint64))

func (*Tree) MarshalJSON

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

func (*Tree) Merge

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

func (*Tree) Pprof

func (t *Tree) Pprof(mdata *PprofMetadata) *profilev1.Profile

func (*Tree) Samples

func (t *Tree) Samples() uint64

func (*Tree) Scale

func (t *Tree) Scale(s uint64)

func (*Tree) String

func (t *Tree) String() string

Jump to

Keyboard shortcuts

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