Imports #
"io"
"net/http"
"regexp"
"time"
internaldriver "github.com/google/pprof/internal/driver"
"github.com/google/pprof/internal/plugin"
"github.com/google/pprof/profile"
"io"
"net/http"
"regexp"
"time"
internaldriver "github.com/google/pprof/internal/driver"
"github.com/google/pprof/internal/plugin"
"github.com/google/pprof/profile"
HTTPServerArgs contains arguments needed by an HTTP server that is exporting a pprof web interface.
type HTTPServerArgs plugin.HTTPServerArgs
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{...}
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)
}
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
}
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
}
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)
}
A Symbolizer introduces symbol information into a profile.
type Symbolizer interface {
Symbolize(mode string, srcs MappingSources, prof *profile.Profile) error
}
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 provides a mechanism to write data under a certain name, typically a filename.
type Writer interface {
Open(name string) (io.WriteCloser, error)
}
A Frame describes a single line in a source file.
type Frame struct {
Func string
File string
Line int
Column int
StartLine int
}
An Inst is a single instruction in an assembly listing.
type Inst struct {
Addr uint64
Text string
Function string
File string
Line int
}
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
}
A Sym describes a single symbol in an object file.
type Sym struct {
Name []string
File string
Start uint64
End uint64
}
type internalObjFile struct {
ObjFile
}
internalObjTool is a wrapper to map from the pprof external interface to the internal interface.
type internalObjTool struct {
ObjTool
}
internalSymbolizer is a wrapper to map from the pprof external interface to the internal interface.
type internalSymbolizer struct {
Symbolizer
}
func (o *internalObjTool) Disasm(file string, start uint64, end uint64, intelSyntax bool) ([]plugin.Inst, error)
func (o *internalObjTool) Open(file string, start uint64, limit uint64, offset uint64, relocationSymbol string) (plugin.ObjFile, 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 PProf(o *Options) error
func (f *internalObjFile) SourceLine(frame uint64) ([]plugin.Frame, error)
func (s *internalSymbolizer) Symbolize(mode string, srcs plugin.MappingSources, prof *profile.Profile) error
func (f *internalObjFile) Symbols(r *regexp.Regexp, addr uint64) ([]*plugin.Sym, error)
func (o *Options) internalOptions() *plugin.Options
Generated with Arrow