profile

package
v0.0.0-...-0f4ba7e Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package profile provides a representation of profile.proto and methods to encode/decode profiles in this format.

Index

Constants

This section is empty.

Variables

View Source
var (

	// LegacyHeapAllocated instructs the heapz parsers to use the
	// allocated memory stats instead of the default in-use memory. Note
	// that tcmalloc doesn't provide all allocated memory, only in-use
	// stats.
	LegacyHeapAllocated bool
)

Functions

This section is empty.

Types

type Function

type Function struct {
	ID         uint64
	Name       string
	SystemName string
	Filename   string
	StartLine  int64
	// contains filtered or unexported fields
}

Function corresponds to Profile.Function

type Line

type Line struct {
	Function *Function
	Line     int64
	// contains filtered or unexported fields
}

Line corresponds to Profile.Line

type Location

type Location struct {
	ID      uint64
	Mapping *Mapping
	Address uint64
	Line    []Line
	// contains filtered or unexported fields
}

Location corresponds to Profile.Location

type Mapping

type Mapping struct {
	ID              uint64
	Start           uint64
	Limit           uint64
	Offset          uint64
	File            string
	BuildID         string
	HasFunctions    bool
	HasFilenames    bool
	HasLineNumbers  bool
	HasInlineFrames bool
	// contains filtered or unexported fields
}

Mapping corresponds to Profile.Mapping

func (*Mapping) Unsymbolizable

func (m *Mapping) Unsymbolizable() bool

Unsymbolizable returns true if a mapping points to a binary for which locations can't be symbolized in principle, at least now. Examples are "[vdso]", [vsyscall]" and some others, see the code.

type Profile

type Profile struct {
	SampleType        []*ValueType
	DefaultSampleType string
	Sample            []*Sample
	Mapping           []*Mapping
	Location          []*Location
	Function          []*Function
	Comments          []string

	DropFrames string
	KeepFrames string

	TimeNanos     int64
	DurationNanos int64
	PeriodType    *ValueType
	Period        int64
	// contains filtered or unexported fields
}

Profile is an in-memory representation of profile.proto.

func Parse

func Parse(r io.Reader) (*Profile, error)

Parse parses a profile and checks for its validity. The input may be a gzip-compressed encoded protobuf or one of many legacy profile formats which may be unsupported in the future.

func ParseData

func ParseData(data []byte) (*Profile, error)

ParseData parses a profile from a buffer and checks for its validity.

func ParseTracebacks

func ParseTracebacks(b []byte) (*Profile, error)

ParseTracebacks parses a set of tracebacks and returns a newly populated profile. It will accept any text file and generate a Profile out of it with any hex addresses it can identify, including a process map if it can recognize one. Each sample will include a tag "source" with the addresses recognized in string format.

func ParseUncompressed

func ParseUncompressed(data []byte) (*Profile, error)

ParseUncompressed parses an uncompressed protobuf into a profile.

func (*Profile) Aggregate

func (p *Profile) Aggregate(inlineFrame, function, filename, linenumber, address bool) error

Aggregate merges the locations in the profile into equivalence classes preserving the request attributes. It also updates the samples to point to the merged locations.

func (*Profile) CheckValid

func (p *Profile) CheckValid() error

CheckValid tests whether the profile is valid. Checks include, but are not limited to:

  • len(Profile.Sample[n].value) == len(Profile.value_unit)
  • Sample.id has a corresponding Profile.Location

func (*Profile) Copy

func (p *Profile) Copy() *Profile

Copy makes a fully independent copy of a profile.

func (*Profile) HasFileLines

func (p *Profile) HasFileLines() bool

HasFileLines determines if all locations in this profile have symbolized file and line number information.

func (*Profile) HasFunctions

func (p *Profile) HasFunctions() bool

HasFunctions determines if all locations in this profile have symbolized function information.

func (*Profile) ParseMemoryMap

func (p *Profile) ParseMemoryMap(rd io.Reader) error

ParseMemoryMap parses a memory map in the format of /proc/self/maps, and overrides the mappings in the current profile. It renumbers the samples and locations in the profile correspondingly.

func (*Profile) Scale

func (p *Profile) Scale(ratio float64)

Scale multiplies all sample values in a profile by a constant.

func (*Profile) ScaleN

func (p *Profile) ScaleN(ratios []float64) error

ScaleN multiplies each sample values in a sample by a different amount.

func (*Profile) String

func (p *Profile) String() string

String dumps a text representation of a profile. Intended mainly for debugging purposes.

func (*Profile) Write

func (p *Profile) Write(w io.Writer) error

Write writes the profile as a gzip-compressed marshaled protobuf.

func (*Profile) WriteUncompressed

func (p *Profile) WriteUncompressed(w io.Writer) error

WriteUncompressed writes the profile as a marshaled protobuf.

type Sample

type Sample struct {
	Location []*Location
	Value    []int64
	Label    map[string][]string
	NumLabel map[string][]int64
	// contains filtered or unexported fields
}

Sample corresponds to Profile.Sample

type ValueType

type ValueType struct {
	Type string // cpu, wall, inuse_space, etc
	Unit string // seconds, nanoseconds, bytes, etc
	// contains filtered or unexported fields
}

ValueType corresponds to Profile.ValueType

Jump to

Keyboard shortcuts

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