cockroach: github.com/cockroachdb/cockroach/pkg/server/debug/pprofui Index | Files

package pprofui

import "github.com/cockroachdb/cockroach/pkg/server/debug/pprofui"

Index

Package Files

fakeflags.go response_writer.go server.go storage.go storage_mem.go ui.go

type MemStorage Uses

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

A MemStorage is a Storage implementation that holds recent profiles in memory.

func NewMemStorage Uses

func NewMemStorage(n int, d time.Duration) *MemStorage

NewMemStorage creates a MemStorage that retains the most recent n records as long as they are less than d old.

Records are dropped only when there is activity (i.e. an old record will only be dropped the next time the storage is accessed).

func (*MemStorage) Get Uses

func (s *MemStorage) Get(id string, read func(io.Reader) error) error

Get implements Storage.

func (*MemStorage) ID Uses

func (s *MemStorage) ID() string

ID implements Storage.

func (*MemStorage) Store Uses

func (s *MemStorage) Store(id string, write func(io.Writer) error) error

Store implements Storage.

type Server Uses

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

A Server serves up the pprof web ui. A request to /<profiletype> generates a profile of the desired type and redirects to the UI for it at /<profiletype>/<id>. Valid profile types at the time of writing include `profile` (cpu), `goroutine`, `threadcreate`, `heap`, `block`, and `mutex`.

func NewServer Uses

func NewServer(storage Storage, hook func(profile string, labels bool, do func())) *Server

NewServer creates a new Server backed by the supplied Storage and optionally a hook which is called when a new profile is created. The closure passed to the hook will carry out the work involved in creating the profile and must be called by the hook. The intention is that hook will be a method such as this:

func hook(profile string, do func()) {

if profile == "profile" {
	something.EnableProfilerLabels()
	defer something.DisableProfilerLabels()
	do()
}

}

func (*Server) ServeHTTP Uses

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Storage Uses

type Storage interface {
    // ID generates a unique ID for use in Store.
    ID() string
    // Store invokes the passed-in closure with a writer that stores its input.
    Store(id string, write func(io.Writer) error) error
    // Get invokes the passed-in closure with a reader for the data at the given id.
    // An error is returned when no data is found.
    Get(id string, read func(io.Reader) error) error
}

Storage exposes the methods for storing and accessing profiles.

Package pprofui imports 22 packages (graph) and is imported by 2 packages. Updated 2019-07-24. Refresh now. Tools for package owners.