driver

package
v0.0.0-...-b3c8e1d Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2019 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package driver implements the core pprof functionality. It can be parameterized with a flag implementation, fetch and symbolize mechanisms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCommand

func AddCommand(cmd string, format int, post PostProcessor, desc, usage string)

AddCommand adds an additional command to the set of commands accepted by pprof. This enables extensions to add new commands for specialized visualization formats. If the command specified already exists, it is overwritten.

func FetchProfiles

func FetchProfiles(s *Source, o *plugin.Options) (*profile.Profile, error)

FetchProfiles fetches and symbolizes the profiles specified by s. It will merge all the profiles it is able to retrieve, even if there are some failures. It will return an error if it is unable to fetch any profiles.

func PProf

func PProf(eo *plugin.Options) error

PProf acquires a profile, and symbolizes it using a profile manager. Then it generates a report formatted according to the options selected through the flags package.

func ServeWebInterface

func ServeWebInterface(hostport string, p *profile.Profile, o *plugin.Options, disableBrowser bool) error

func SetDefaults

func SetDefaults(o *plugin.Options) *plugin.Options

SetDefaults returns a new plugin.Options with zero fields sets to sensible defaults.

func SetVariableDefault

func SetVariableDefault(variable, value string)

SetVariableDefault sets the default value for a pprof variable. This enables extensions to set their own defaults.

Types

type GoFlags

type GoFlags struct {
	UsageMsgs []string
}

GoFlags implements the plugin.FlagSet interface.

func (*GoFlags) AddExtraUsage

func (f *GoFlags) AddExtraUsage(eu string)

AddExtraUsage implements the plugin.FlagSet interface.

func (*GoFlags) Bool

func (*GoFlags) Bool(o string, d bool, c string) *bool

Bool implements the plugin.FlagSet interface.

func (*GoFlags) BoolVar

func (*GoFlags) BoolVar(b *bool, o string, d bool, c string)

BoolVar implements the plugin.FlagSet interface.

func (*GoFlags) ExtraUsage

func (f *GoFlags) ExtraUsage() string

ExtraUsage implements the plugin.FlagSet interface.

func (*GoFlags) Float64

func (*GoFlags) Float64(o string, d float64, c string) *float64

Float64 implements the plugin.FlagSet interface.

func (*GoFlags) Float64Var

func (*GoFlags) Float64Var(f *float64, o string, d float64, c string)

Float64Var implements the plugin.FlagSet interface. the value of the flag.

func (*GoFlags) Int

func (*GoFlags) Int(o string, d int, c string) *int

Int implements the plugin.FlagSet interface.

func (*GoFlags) IntVar

func (*GoFlags) IntVar(i *int, o string, d int, c string)

IntVar implements the plugin.FlagSet interface.

func (*GoFlags) Parse

func (*GoFlags) Parse(usage func()) []string

Parse implements the plugin.FlagSet interface.

func (*GoFlags) String

func (*GoFlags) String(o, d, c string) *string

String implements the plugin.FlagSet interface.

func (*GoFlags) StringList

func (*GoFlags) StringList(o, d, c string) *[]*string

StringList implements the plugin.FlagSet interface.

func (*GoFlags) StringVar

func (*GoFlags) StringVar(s *string, o, d, c string)

StringVar implements the plugin.FlagSet interface.

type PostProcessor

type PostProcessor func(input io.Reader, output io.Writer, ui plugin.UI) error

PostProcessor is a function that applies post-processing to the report output

type Source

type Source struct {
	Sources   []string
	ExecName  string
	BuildID   string
	Base      []string
	DiffBase  bool
	Normalize bool

	Seconds            int
	Timeout            int
	Symbolize          string
	HTTPHostport       string
	HTTPDisableBrowser bool
	Comment            string
}

func ParseFlags

func ParseFlags(o *plugin.Options) (*Source, []string, error)

ParseFlags parses the command lines through the specified flags package and returns the source of the profile and optionally the command for the kind of report to generate (nil for interactive use).

type WebInterface

type WebInterface struct {
	// contains filtered or unexported fields
}

WebInterface holds the state needed for serving a browser based interface.

func MakeWebInterface

func MakeWebInterface(p *profile.Profile, opt *plugin.Options) *WebInterface

func (*WebInterface) Disasm

func (ui *WebInterface) Disasm(w http.ResponseWriter, req *http.Request)

disasm generates a web page containing disassembly.

func (*WebInterface) Dot

func (ui *WebInterface) Dot(w http.ResponseWriter, req *http.Request)

dot generates a web page containing an svg diagram.

func (*WebInterface) FlameGraph

func (ui *WebInterface) FlameGraph(w http.ResponseWriter, req *http.Request)

flamegraph generates a web page containing a flamegraph.

func (*WebInterface) Peek

func (ui *WebInterface) Peek(w http.ResponseWriter, req *http.Request)

peek generates a web page listing callers/callers.

func (*WebInterface) Source

func (ui *WebInterface) Source(w http.ResponseWriter, req *http.Request)

source generates a web page containing source code annotated with profile data.

func (*WebInterface) Top

func (ui *WebInterface) Top(w http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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