pprofutils

package
v1.49.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 9 Imported by: 0

README

pprofutils

Internal fork of https://github.com/felixge/pprofutils stripped to only include essential code and tests. It's used for delta profiles as well as testing.

It'd be nice to keep this in sync with upstream, but no worries if not. We just need the delta profile stuff to work.

Documentation

Overview

Package pprofutils is a fork of github.com/felixge/pprofutils, see README.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delta

type Delta struct {
	// SampleTypes limits the delta calcultion to the given sample types. Other
	// sample types will retain the values of profile b. The defined sample types
	// must exist in the profile, otherwise derivation will fail with an error.
	//
	// The use case for this is to deal with the heap profile which
	// contains alloc and inuse sample types, but delta profiling makes no sense
	// for the latter.
	SampleTypes []ValueType
}

Delta describes how to compute the delta between two profiles and implements the conversion.

func (Delta) Convert

func (d Delta) Convert(a, b *profile.Profile) (*profile.Profile, error)

Convert computes the delta between all values b-a and returns them as a new profile. Samples that end up with a delta of 0 are dropped. WARNING: Profile a will be mutated by this function. You should pass a copy if that's undesirable.

type Protobuf

type Protobuf struct {
	// SampleTypes causes the text output to begin with a header line listing
	// the sample types found in the profile. This is a custom extension to the
	// folded text format.
	SampleTypes bool
}

Protobuf converts from pprof's protobuf to folded text format.

func (Protobuf) Convert

func (p Protobuf) Convert(protobuf *profile.Profile, text io.Writer) error

Convert marshals the given protobuf profile into folded text format.

type Text

type Text struct{}

Text converts from folded text to protobuf format.

func (Text) Convert

func (c Text) Convert(text io.Reader) (*profile.Profile, error)

Convert parses the given text and returns it as protobuf profile.

type ValueType

type ValueType struct {
	Type string
	Unit string
}

ValueType describes the type and unit of a value.

Jump to

Keyboard shortcuts

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