flamebearer

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlamebearerToStandaloneHTML

func FlamebearerToStandaloneHTML(fb *FlamebearerProfile, dir http.FileSystem, w io.Writer) error

FlamebearerToStandaloneHTML converts and writes a flamebearer into HTML TODO cache template creation and whatnot?

func ProfileToTree

func ProfileToTree(fb FlamebearerProfile) (*tree.Tree, error)

ProfileToTree converts a FlamebearerProfile into a Tree It currently only supports Single profiles

Types

type FlamebearerMetadataV1

type FlamebearerMetadataV1 struct {
	// Data format. Supported values are "single" and "double" (diff).
	// required: true
	Format string `json:"format"`
	// Name of the spy / profiler used to generate the profile, if any.
	SpyName string `json:"spyName"`
	// Sample rate at which the profiler was operating.
	SampleRate uint32 `json:"sampleRate"`
	// The unit of measurement for the profiled data.
	Units metadata.Units `json:"units"`
	// A name that identifies the profile.
	Name string `json:"name"`
}

type FlamebearerProfile

type FlamebearerProfile struct {
	// Version of the data format. No version / version zero is an unformalized format.
	Version uint `json:"version"`
	FlamebearerProfileV1
	Telemetry map[string]interface{} `json:"telemetry,omitempty"`
}

swagger:model FlamebearerProfile is a versioned flambearer based profile. It's the native format both for rendering and file saving (in adhoc mode).

func Diff

func Diff(name string, base, diff *FlamebearerProfile, maxNodes int) (FlamebearerProfile, error)

Diff takes two single profiles and generates a diff profile

func NewCombinedProfile

func NewCombinedProfile(base, diff ProfileConfig) (FlamebearerProfile, error)

func NewProfile

func NewProfile(in ProfileConfig) FlamebearerProfile

func (FlamebearerProfile) Validate

func (fb FlamebearerProfile) Validate() error

type FlamebearerProfileV1

type FlamebearerProfileV1 struct {
	// Flamebearer data.
	// required: true
	Flamebearer FlamebearerV1 `json:"flamebearer"`
	// Metadata associated to the profile.
	// required: true
	Metadata FlamebearerMetadataV1 `json:"metadata"`
	// Timeline associated to the profile, used for continuous profiling only.
	Timeline *FlamebearerTimelineV1            `json:"timeline"`
	Groups   map[string]*FlamebearerTimelineV1 `json:"groups"`
	Heatmap  *Heatmap                          `json:"heatmap"`
	// Number of samples in the left / base profile. Only used in "double" format.
	LeftTicks uint64 `json:"leftTicks,omitempty"`
	// Number of samples in the right / diff profile. Only used in "double" format.
	RightTicks uint64 `json:"rightTicks,omitempty"`
}

swagger:model FlamebearerProfileV1 defines the v1 of the profile format

func (FlamebearerProfileV1) Validate

func (fb FlamebearerProfileV1) Validate() error

Validate the V1 profile. A custom validation is used as the constraints are hard to define in a generic way (e.g. using https://github.com/go-playground/validator)

type FlamebearerTimelineV1

type FlamebearerTimelineV1 struct {
	// Time at which the timeline starts, as a Unix timestamp.
	// required: true
	StartTime int64 `json:"startTime"`
	// A sequence of samples starting at startTime, spaced by durationDelta seconds
	// required: true
	Samples []uint64 `json:"samples"`
	// Time delta between samples, in seconds.
	// required: true
	DurationDelta int64         `json:"durationDelta"`
	Watermarks    map[int]int64 `json:"watermarks"`
}

type FlamebearerV1

type FlamebearerV1 struct {
	// Names is the sequence of symbol names.
	// required: true
	Names []string `json:"names"`
	// Levels contains the flamebearer nodes. Each level represents a row in the flamegraph.
	// For each row / level, there's a sequence of values. These values are grouped in chunks
	// which size depend on the flamebearer format: 4 for "single", 7 for "double".
	// For "single" format, each chunk has the following data:
	//     i+0 = x offset (prefix sum of the level total values), delta encoded.
	//     i+1 = total samples (including the samples in its children nodes).
	//     i+2 = self samples (excluding the samples in its children nodes).
	//     i+3 = index in names array
	//
	// For "double" format, each chunk has the following data:
	//     i+0 = x offset (prefix sum of the level total values), delta encoded, base / left tree.
	//     i+1 = total samples (including the samples in its children nodes)   , base / left tree.
	//     i+2 = self samples (excluding the samples in its children nodes)    , base / left tree.
	//     i+3 = x offset (prefix sum of the level total values), delta encoded, diff / right tree.
	//     i+4 = total samples (including the samples in its children nodes)   , diff / right tree.
	//     i+5 = self samples (excluding the samples in its children nodes)    , diff / right tree.
	//     i+6 = index in the names array
	//
	// required: true
	Levels [][]int `json:"levels"`
	// Total number of samples.
	// required: true
	NumTicks int `json:"numTicks"`
	// Maximum self value in any node.
	// required: true
	MaxSelf int `json:"maxSelf"`
}

swagger:model FlamebearerV1 defines the actual profiling data.

type Heatmap

type Heatmap struct {
	// Values matrix contain values that indicate count of value occurrences,
	// satisfying boundaries of X and Y bins: [StartTime:EndTime) and (MinValue:MaxValue].
	// A value can be accessed via Values[x][y], where:
	//   0 <= x < TimeBuckets, and
	//   0 <= y < ValueBuckets.
	Values [][]uint64 `json:"values"`
	// TimeBuckets denote number of bins on X axis.
	// Length of Values array.
	TimeBuckets int64 `json:"timeBuckets"`
	// ValueBuckets denote number of bins on Y axis.
	// Length of any item in the Values array.
	ValueBuckets int64 `json:"valueBuckets"`
	// StartTime and EndTime indicate boundaries of X axis: [StartTime:EndTime).
	StartTime int64 `json:"startTime"`
	EndTime   int64 `json:"endTime"`
	// MinValue and MaxValue indicate boundaries of Y axis: (MinValue:MaxValue].
	MinValue uint64 `json:"minValue"`
	MaxValue uint64 `json:"maxValue"`
	// MinDepth and MaxDepth indicate boundaries of Z axis: [MinDepth:MaxDepth].
	// MinDepth is the minimal non-zero value that can be found in Values.
	MinDepth uint64 `json:"minDepth"`
	MaxDepth uint64 `json:"maxDepth"`
}

type ProfileConfig

type ProfileConfig struct {
	Name      string
	MaxNodes  int
	Metadata  metadata.Metadata
	Tree      *tree.Tree
	Timeline  *segment.Timeline
	Heatmap   *heatmap.Heatmap
	Groups    map[string]*segment.Timeline
	Telemetry map[string]interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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