stats

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SignalMeta reports Go process metadata.
	SignalMeta = byte(0x1)

	// SignalStats reports Go process stats.
	SignalStats = byte(0x2)

	// Delimiter indicates to complete the writing.
	Delimiter = '\n'
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MemStats

type MemStats struct {
	HeapAlloc uint64
	HeapIdle  uint64
	HeapInuse uint64
}

MemStats records statistics about the memory allocator.

type Meta

type Meta struct {
	PID        int
	Username   string
	Command    string
	GoMaxProcs int
	NumCPU     int
}

Meta represents process metadata, which will be not changed as long as the process continues.

func NewMeta

func NewMeta() (*Meta, error)

func (*Meta) String

func (m *Meta) String() string

type Stats

type Stats struct {
	// The number of goroutines that currently exist.
	Goroutines int
	// How many percent of the CPU time this process uses
	CPUUsage float64
	MemStats
}

Stats represents the statistical data of the process at the time of measurement.

func NewStats

func NewStats() (*Stats, error)

NewStats gives back a Stats after getting the statistical data at that point in time. Undesirable to call it at high rate.

Jump to

Keyboard shortcuts

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