driver

Imports

Imports #

"io"
"net/http"
"regexp"
"time"
internaldriver "github.com/google/pprof/internal/driver"
"github.com/google/pprof/internal/plugin"
"github.com/google/pprof/profile"

Type Aliases

HTTPServerArgs type #

HTTPServerArgs contains arguments needed by an HTTP server that is exporting a pprof web interface.

type HTTPServerArgs plugin.HTTPServerArgs

MappingSources type #

MappingSources map each profile.Mapping to the source of the profile. The key is either Mapping.File or Mapping.BuildId.

type MappingSources map[string][]struct{...}

Interfaces

Fetcher interface #

A Fetcher reads and returns the profile named by src, using the specified duration and timeout. It returns the fetched profile and a string indicating a URL from where the profile was fetched, which may be different than src.

type Fetcher interface {
Fetch(src string, duration time.Duration, timeout time.Duration) (*profile.Profile, string, error)
}

FlagSet interface #

A FlagSet creates and parses command-line flags. It is similar to the standard flag.FlagSet.

type FlagSet interface {
Bool(name string, def bool, usage string) *bool
Int(name string, def int, usage string) *int
Float64(name string, def float64, usage string) *float64
String(name string, def string, usage string) *string
StringList(name string, def string, usage string) *[]*string
ExtraUsage() string
AddExtraUsage(eu string)
Parse(usage func()) []string
}

ObjFile interface #

An ObjFile is a single object file: a shared library or executable.

type ObjFile interface {
Name() string
ObjAddr(addr uint64) (uint64, error)
BuildID() string
SourceLine(addr uint64) ([]Frame, error)
Symbols(r *regexp.Regexp, addr uint64) ([]*Sym, error)
Close() error
}

ObjTool interface #

An ObjTool inspects shared libraries and executable files.

type ObjTool interface {
Open(file string, start uint64, limit uint64, offset uint64, relocationSymbol string) (ObjFile, error)
Disasm(file string, start uint64, end uint64, intelSyntax bool) ([]Inst, error)
}

Symbolizer interface #

A Symbolizer introduces symbol information into a profile.

type Symbolizer interface {
Symbolize(mode string, srcs MappingSources, prof *profile.Profile) error
}

UI interface #

A UI manages user interactions.

type UI interface {
ReadLine(prompt string) (string, error)
Print(...interface{})
PrintErr(...interface{})
IsTerminal() bool
WantBrowser() bool
SetAutoComplete(complete func(string) string)
}

Writer interface #

Writer provides a mechanism to write data under a certain name, typically a filename.

type Writer interface {
Open(name string) (io.WriteCloser, error)
}

Structs

Frame struct #

A Frame describes a single line in a source file.

type Frame struct {
Func string
File string
Line int
Column int
StartLine int
}

Inst struct #

An Inst is a single instruction in an assembly listing.

type Inst struct {
Addr uint64
Text string
Function string
File string
Line int
}

Options struct #

Options groups all the optional plugins into pprof.

type Options struct {
Writer Writer
Flagset FlagSet
Fetch Fetcher
Sym Symbolizer
Obj ObjTool
UI UI
HTTPServer func(*HTTPServerArgs) error
HTTPTransport http.RoundTripper
}

Sym struct #

A Sym describes a single symbol in an object file.

type Sym struct {
Name []string
File string
Start uint64
End uint64
}

internalObjFile struct #

type internalObjFile struct {
ObjFile
}

internalObjTool struct #

internalObjTool is a wrapper to map from the pprof external interface to the internal interface.

type internalObjTool struct {
ObjTool
}

internalSymbolizer struct #

internalSymbolizer is a wrapper to map from the pprof external interface to the internal interface.

type internalSymbolizer struct {
Symbolizer
}

Functions

Disasm method #

func (o *internalObjTool) Disasm(file string, start uint64, end uint64, intelSyntax bool) ([]plugin.Inst, error)

Open method #

func (o *internalObjTool) Open(file string, start uint64, limit uint64, offset uint64, relocationSymbol string) (plugin.ObjFile, error)

PProf function #

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 PProf(o *Options) error

SourceLine method #

func (f *internalObjFile) SourceLine(frame uint64) ([]plugin.Frame, error)

Symbolize method #

func (s *internalSymbolizer) Symbolize(mode string, srcs plugin.MappingSources, prof *profile.Profile) error

Symbols method #

func (f *internalObjFile) Symbols(r *regexp.Regexp, addr uint64) ([]*plugin.Sym, error)

internalOptions method #

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

Generated with Arrow