testhelper

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FooMapping = &profile.Mapping{
		ID:              1,
		Start:           uint64(1),
		Limit:           uint64(2),
		Offset:          uint64(3),
		File:            "foobar.so",
		BuildID:         "v1",
		HasFunctions:    true,
		HasFilenames:    true,
		HasLineNumbers:  true,
		HasInlineFrames: false,
	}
	FooFunction = &profile.Function{
		ID:         1,
		Name:       "foo",
		SystemName: "sfoo",
		Filename:   "foo.go",
		StartLine:  1,
	}
	FooLocation = &profile.Location{
		ID:       1,
		Address:  1,
		IsFolded: false,
		Mapping:  FooMapping,
		Line: []profile.Line{
			{
				Function: FooFunction,
				Line:     100,
			},
		},
	}
	BarFunction = &profile.Function{
		ID:         2,
		Name:       "bar",
		SystemName: "sbar",
		Filename:   "bar.go",
		StartLine:  1,
	}
	BarLocation = &profile.Location{
		ID:       2,
		Address:  2,
		IsFolded: true,
		Mapping:  FooMapping,
		Line: []profile.Line{
			{
				Function: BarFunction,
				Line:     200,
			},
		},
	}

	FooBarProfile = &profile.Profile{
		SampleType: []*profile.ValueType{
			{Type: "cpu", Unit: "nanoseconds"},
		},
		DefaultSampleType: "cpu",
		Sample: []*profile.Sample{
			{
				Value:    []int64{1},
				Location: []*profile.Location{FooLocation, BarLocation},
			},
			{
				Value:    []int64{2},
				Location: []*profile.Location{FooLocation},
			},
			{
				Value:    []int64{3},
				Location: []*profile.Location{BarLocation},
			},
		},
		TimeNanos:     1,
		DurationNanos: int64(15 * time.Nanosecond),
		Mapping:       []*profile.Mapping{FooMapping},
		Location:      []*profile.Location{FooLocation, BarLocation},
		Function:      []*profile.Function{FooFunction, BarFunction},
		PeriodType: &profile.ValueType{
			Type: "cpu",
			Unit: "nanoseconds",
		},
		Period: 10000000,
	}
)

Functions

This section is empty.

Types

type ProfileBuilder

type ProfileBuilder struct {
	*profilev1.Profile

	uuid.UUID
	Labels []*typesv1.LabelPair
	// contains filtered or unexported fields
}

func NewProfileBuilder

func NewProfileBuilder(ts int64) *ProfileBuilder

func (*ProfileBuilder) CPUProfile

func (m *ProfileBuilder) CPUProfile() *ProfileBuilder

func (*ProfileBuilder) ForStacktraceString added in v0.1.2

func (m *ProfileBuilder) ForStacktraceString(stacktraces ...string) *StacktraceBuilder

func (*ProfileBuilder) MemoryProfile

func (m *ProfileBuilder) MemoryProfile() *ProfileBuilder

func (*ProfileBuilder) Name

func (m *ProfileBuilder) Name() string

func (*ProfileBuilder) ToModel

func (m *ProfileBuilder) ToModel() (*schemav1.Profile, []phlaremodel.Labels)

func (*ProfileBuilder) WithLabels

func (m *ProfileBuilder) WithLabels(lv ...string) *ProfileBuilder

type StacktraceBuilder

type StacktraceBuilder struct {
	*ProfileBuilder
	// contains filtered or unexported fields
}

func (*StacktraceBuilder) AddSamples

func (s *StacktraceBuilder) AddSamples(samples ...int64)

Jump to

Keyboard shortcuts

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