profile

package module
v0.0.0-...-231994c Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

README

Go Report Card Gitpod ready-to-code

grpc-profile

Go profiling over GRPC

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallOption

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

CallOption will create a Call Option for the GRPC Profile Client

type Client

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

Client will store GRPC Profile Client instance. We can create a instance of the client using `NewClient()` function

func NewClient

func NewClient(ctx context.Context, serverAddress string, options ...*DialOption) (client *Client, err error)

NewClient function will create a GRPC Profile Client instance

func (*Client) BinaryDump

func (client *Client) BinaryDump(ctx context.Context, writer io.Writer) error

BinaryDump function will get a binary dump of the remote binary

func (*Client) Connect

func (client *Client) Connect(ctx context.Context, serverAddress string) error

Connect function will connect GRPC Profile Client to GRPC Profile Server

func (*Client) GC

func (client *Client) GC(ctx context.Context) error

GC function will run GC on remote server

func (*Client) GetInfo

func (client *Client) GetInfo(ctx context.Context) (*InfoType, error)

GetInfo function will get current information about the agent

func (*Client) LookupProfile

func (client *Client) LookupProfile(ctx context.Context, t LookupType, writer io.Writer) error

LookupProfile will run a profile for lookup pprof type

func (*Client) NonLookupProfile

func (client *Client) NonLookupProfile(ctx context.Context, t NonLookupType, d time.Duration, writer io.Writer) error

NonLookupProfile will run a profile for non lookup pprof type

func (*Client) Set

func (client *Client) Set(ctx context.Context, v Variable, r int) (int, error)

Set function will set the GRPC Profile Variable

func (*Client) SetCallOption

func (client *Client) SetCallOption(option *CallOption) error

SetCallOption function will be used to set `CallOption` to GRPC Profile Client

func (*Client) SetCallOptions

func (client *Client) SetCallOptions(options ...*CallOption) (err error)

SetCallOptions function will be used to set `CallOption`s to GRPC Profile Client

func (*Client) SetDialOption

func (client *Client) SetDialOption(option *DialOption) error

SetDialOption function will be used to set `DialOption` to GRPC Profile Client

func (*Client) SetDialOptions

func (client *Client) SetDialOptions(options ...*DialOption) (err error)

SetDialOptions function will be used to set `DialOption`s to GRPC Profile Client

func (*Client) Stop

func (client *Client) Stop() error

Stop function will stop GRPC Profile Client

func (*Client) StopNonLookupProfile

func (client *Client) StopNonLookupProfile(ctx context.Context, t NonLookupType) (err error)

StopNonLookupProfile will stop non lookup profile type (if running)

type DialOption

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

DialOption will create a Dial Option for the GRPC Profile Client

func DialAuthTypeInsecure

func DialAuthTypeInsecure() *DialOption

DialAuthTypeInsecure function will create a Insecure Auth type GRPC Profile Client Dial option

func DialAuthTypeTLS

func DialAuthTypeTLS(certFile string) *DialOption

DialAuthTypeTLS function will create a TLS Secure Auth type GRPC Profile Client Dial option

type FileInfo

type FileInfo struct {
	Name     string
	Size     int64
	Mode     uint
	ModeTime time.Time
}

FileInfo will store informarion about a file

type IDName

type IDName struct {
	ID   int
	Name string
}

IDName will store User / Group ID and Name

type InfoType

type InfoType struct {
	GOOS           string
	GOARCH         string
	GOMAXPROCS     int
	NumCPU         int
	NumCgoCall     int
	NumGoroutine   int
	Version        string
	ProcessStats   ProcessStats
	MemStats       MemStats
	MemProfileRate int
}

InfoType will store all informations about the agent

type LookupType

type LookupType int

LookupType is type for GRPC Profile LookupType

const (
	// HeapType - Memory / Heap Profile Type
	HeapType LookupType = iota
	// MutexType - Mutex Profile Type
	MutexType
	// BlockType - Block Profile Type
	BlockType
	// ThreadCreateType - ThreadCreate Profile Type
	ThreadCreateType
	// GoRoutineType - GoRoutine Profile Type
	GoRoutineType
)

type MemStats

type MemStats struct {
	Alloc        uint64
	TotalAlloc   uint64
	Sys          uint64
	Lookups      uint64
	Mallocs      uint64
	Frees        uint64
	HeapAlloc    uint64
	HeapSys      uint64
	HeapIdle     uint64
	HeapInuse    uint64
	HeapReleased uint64
	HeapObjects  uint64
	StackInuse   uint64
	StackSys     uint64
	MSpanInuse   uint64
	MSpanSys     uint64
	MCacheInuse  uint64
	MCacheSys    uint64
	BuckHashSys  uint64
	GCSys        uint64
	OtherSys     uint64
	NextGC       uint64
	LastGC       time.Time
	PauseTotalNs time.Duration
	LastPause    time.Time
	NumGC        uint32
	NumForcedGC  uint32
}

MemStats will store status about the memory

type NonLookupType

type NonLookupType int

NonLookupType is type for GRPC Profile NonLookupType

const (
	// CPUType - CPU profile type
	CPUType NonLookupType = iota

	// TraceType - Trace Profile Type
	TraceType
)

type ProcessStats

type ProcessStats struct {
	Environ         []string
	Executable      string
	ExecutableLStat FileInfo
	ExecutableStat  FileInfo
	UID             IDName
	GID             IDName
	EUID            IDName
	EGID            IDName
	Groups          []IDName
	PageSize        int
	PID             int
	PPID            int
	WD              string
	Hostname        string
	UserCacheDir    string
	UserConfigDir   string
	UserHomeDir     string
}

ProcessStats will store status about the process

type Variable

type Variable int

Variable is type for GRPC Profile Variable

const (
	// MemProfRate controls the fraction of memory allocations that are recorded and reported in the memory profile.
	// The profiler aims to sample an average of one allocation per MemProfileRate bytes allocated.
	// To include every allocated block in the profile, set MemProfileRate to 1. To turn off profiling entirely, set
	// MemProfileRate to 0.
	MemProfRate Variable = iota

	// CPUProfRate controls CPU profiling rate to hz samples per second. If hz <= 0, SetCPUProfileRate turns off
	// profiling. If the profiler is on, the rate cannot be changed without first turning it off.
	CPUProfRate

	// MutexProfileFraction controls the fraction of mutex contention events that are reported in the mutex profile.
	// On average 1/rate events are reported. To turn off profiling entirely, pass rate 0.
	MutexProfileFraction

	// BlockProfileRate controls the fraction of goroutine blocking events that are reported in the blocking profile.
	// The profiler aims to sample an average of one blocking event per rate nanoseconds spent blocked.
	// To include every blocking event in the profile, pass rate = 1. To turn off profiling entirely, pass rate <= 0.
	BlockProfileRate
)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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