pprof

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: BSD-3-Clause Imports: 6 Imported by: 4

Documentation

Overview

Package pprof defines an interface for accessing runtime profiling data in the format expected by the pprof visualization tool. For more information about pprof, see http://code.google.com/p/google-perftools/.

Index

Constants

This section is empty.

Variables

View Source
var PProfDesc rpc.InterfaceDesc = descPProf

PProfDesc describes the PProf interface.

Functions

This section is empty.

Types

type PProfClientMethods

type PProfClientMethods interface {
	// CmdLine returns the command-line arguments of the server, including
	// the name of the executable.
	CmdLine(*context.T, ...rpc.CallOpt) ([]string, error)
	// Profiles returns the list of available profiles.
	Profiles(*context.T, ...rpc.CallOpt) ([]string, error)
	// Profile streams the requested profile. The debug parameter enables
	// additional output. Passing debug=0 includes only the hexadecimal
	// addresses that pprof needs. Passing debug=1 adds comments translating
	// addresses to function names and line numbers, so that a programmer
	// can read the profile without tools.
	Profile(_ *context.T, name string, debug int32, _ ...rpc.CallOpt) (PProfProfileClientCall, error)
	// CpuProfile enables CPU profiling for the requested duration and
	// streams the profile data.
	CpuProfile(_ *context.T, seconds int32, _ ...rpc.CallOpt) (PProfCpuProfileClientCall, error)
	// Symbol looks up the program counters and returns their respective
	// function names.
	Symbol(_ *context.T, programCounters []uint64, _ ...rpc.CallOpt) ([]string, error)
}

PProfClientMethods is the client interface containing PProf methods.

type PProfClientStub

type PProfClientStub interface {
	PProfClientMethods
}

PProfClientStub embeds PProfClientMethods and is a placeholder for additional management operations.

func PProfClient

func PProfClient(name string) PProfClientStub

PProfClient returns a client stub for PProf.

type PProfCpuProfileClientCall

type PProfCpuProfileClientCall interface {
	PProfCpuProfileClientStream
	// Finish blocks until the server is done, and returns the positional return
	// values for call.
	//
	// Finish returns immediately if the call has been canceled; depending on the
	// timing the output could either be an error signaling cancelation, or the
	// valid positional return values from the server.
	//
	// Calling Finish is mandatory for releasing stream resources, unless the call
	// has been canceled or any of the other methods return an error.  Finish should
	// be called at most once.
	Finish() error
}

PProfCpuProfileClientCall represents the call returned from PProf.CpuProfile.

type PProfCpuProfileClientStream

type PProfCpuProfileClientStream interface {
	// RecvStream returns the receiver side of the PProf.CpuProfile client stream.
	RecvStream() interface {
		// Advance stages an item so that it may be retrieved via Value.  Returns
		// true iff there is an item to retrieve.  Advance must be called before
		// Value is called.  May block if an item is not available.
		Advance() bool
		// Value returns the item that was staged by Advance.  May panic if Advance
		// returned false or was not called.  Never blocks.
		Value() []byte
		// Err returns any error encountered by Advance.  Never blocks.
		Err() error
	}
}

PProfCpuProfileClientStream is the client stream for PProf.CpuProfile.

type PProfCpuProfileServerCall

type PProfCpuProfileServerCall interface {
	rpc.ServerCall
	PProfCpuProfileServerStream
}

PProfCpuProfileServerCall represents the context passed to PProf.CpuProfile.

type PProfCpuProfileServerCallStub

type PProfCpuProfileServerCallStub struct {
	rpc.StreamServerCall
}

PProfCpuProfileServerCallStub is a wrapper that converts rpc.StreamServerCall into a typesafe stub that implements PProfCpuProfileServerCall.

func (*PProfCpuProfileServerCallStub) Init

Init initializes PProfCpuProfileServerCallStub from rpc.StreamServerCall.

func (*PProfCpuProfileServerCallStub) SendStream

func (s *PProfCpuProfileServerCallStub) SendStream() interface {
	Send(item []byte) error
}

SendStream returns the send side of the PProf.CpuProfile server stream.

type PProfCpuProfileServerStream

type PProfCpuProfileServerStream interface {
	// SendStream returns the send side of the PProf.CpuProfile server stream.
	SendStream() interface {
		// Send places the item onto the output stream.  Returns errors encountered
		// while sending.  Blocks if there is no buffer space; will unblock when
		// buffer space is available.
		Send(item []byte) error
	}
}

PProfCpuProfileServerStream is the server stream for PProf.CpuProfile.

type PProfProfileClientCall

type PProfProfileClientCall interface {
	PProfProfileClientStream
	// Finish blocks until the server is done, and returns the positional return
	// values for call.
	//
	// Finish returns immediately if the call has been canceled; depending on the
	// timing the output could either be an error signaling cancelation, or the
	// valid positional return values from the server.
	//
	// Calling Finish is mandatory for releasing stream resources, unless the call
	// has been canceled or any of the other methods return an error.  Finish should
	// be called at most once.
	Finish() error
}

PProfProfileClientCall represents the call returned from PProf.Profile.

type PProfProfileClientStream

type PProfProfileClientStream interface {
	// RecvStream returns the receiver side of the PProf.Profile client stream.
	RecvStream() interface {
		// Advance stages an item so that it may be retrieved via Value.  Returns
		// true iff there is an item to retrieve.  Advance must be called before
		// Value is called.  May block if an item is not available.
		Advance() bool
		// Value returns the item that was staged by Advance.  May panic if Advance
		// returned false or was not called.  Never blocks.
		Value() []byte
		// Err returns any error encountered by Advance.  Never blocks.
		Err() error
	}
}

PProfProfileClientStream is the client stream for PProf.Profile.

type PProfProfileServerCall

type PProfProfileServerCall interface {
	rpc.ServerCall
	PProfProfileServerStream
}

PProfProfileServerCall represents the context passed to PProf.Profile.

type PProfProfileServerCallStub

type PProfProfileServerCallStub struct {
	rpc.StreamServerCall
}

PProfProfileServerCallStub is a wrapper that converts rpc.StreamServerCall into a typesafe stub that implements PProfProfileServerCall.

func (*PProfProfileServerCallStub) Init

Init initializes PProfProfileServerCallStub from rpc.StreamServerCall.

func (*PProfProfileServerCallStub) SendStream

func (s *PProfProfileServerCallStub) SendStream() interface {
	Send(item []byte) error
}

SendStream returns the send side of the PProf.Profile server stream.

type PProfProfileServerStream

type PProfProfileServerStream interface {
	// SendStream returns the send side of the PProf.Profile server stream.
	SendStream() interface {
		// Send places the item onto the output stream.  Returns errors encountered
		// while sending.  Blocks if there is no buffer space; will unblock when
		// buffer space is available.
		Send(item []byte) error
	}
}

PProfProfileServerStream is the server stream for PProf.Profile.

type PProfServerMethods

type PProfServerMethods interface {
	// CmdLine returns the command-line arguments of the server, including
	// the name of the executable.
	CmdLine(*context.T, rpc.ServerCall) ([]string, error)
	// Profiles returns the list of available profiles.
	Profiles(*context.T, rpc.ServerCall) ([]string, error)
	// Profile streams the requested profile. The debug parameter enables
	// additional output. Passing debug=0 includes only the hexadecimal
	// addresses that pprof needs. Passing debug=1 adds comments translating
	// addresses to function names and line numbers, so that a programmer
	// can read the profile without tools.
	Profile(_ *context.T, _ PProfProfileServerCall, name string, debug int32) error
	// CpuProfile enables CPU profiling for the requested duration and
	// streams the profile data.
	CpuProfile(_ *context.T, _ PProfCpuProfileServerCall, seconds int32) error
	// Symbol looks up the program counters and returns their respective
	// function names.
	Symbol(_ *context.T, _ rpc.ServerCall, programCounters []uint64) ([]string, error)
}

PProfServerMethods is the interface a server writer implements for PProf.

type PProfServerStub

type PProfServerStub interface {
	PProfServerStubMethods
	// DescribeInterfaces the PProf interfaces.
	Describe__() []rpc.InterfaceDesc
}

PProfServerStub adds universal methods to PProfServerStubMethods.

func PProfServer

func PProfServer(impl PProfServerMethods) PProfServerStub

PProfServer returns a server stub for PProf. It converts an implementation of PProfServerMethods into an object that may be used by rpc.Server.

type PProfServerStubMethods

type PProfServerStubMethods interface {
	// CmdLine returns the command-line arguments of the server, including
	// the name of the executable.
	CmdLine(*context.T, rpc.ServerCall) ([]string, error)
	// Profiles returns the list of available profiles.
	Profiles(*context.T, rpc.ServerCall) ([]string, error)
	// Profile streams the requested profile. The debug parameter enables
	// additional output. Passing debug=0 includes only the hexadecimal
	// addresses that pprof needs. Passing debug=1 adds comments translating
	// addresses to function names and line numbers, so that a programmer
	// can read the profile without tools.
	Profile(_ *context.T, _ *PProfProfileServerCallStub, name string, debug int32) error
	// CpuProfile enables CPU profiling for the requested duration and
	// streams the profile data.
	CpuProfile(_ *context.T, _ *PProfCpuProfileServerCallStub, seconds int32) error
	// Symbol looks up the program counters and returns their respective
	// function names.
	Symbol(_ *context.T, _ rpc.ServerCall, programCounters []uint64) ([]string, error)
}

PProfServerStubMethods is the server interface containing PProf methods, as expected by rpc.Server. The only difference between this interface and PProfServerMethods is the streaming methods.

Jump to

Keyboard shortcuts

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