monitor

package
v1.0.1003 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Monitor

type Monitor struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewMonitor

func NewMonitor(lo interfaces.Listener) *Monitor

func (*Monitor) ByteCountIEC

func (c *Monitor) ByteCountIEC(b uint64) string

func (*Monitor) ByteCountSI

func (c *Monitor) ByteCountSI(b uint64) string

func (*Monitor) Get

func (c *Monitor) Get() *proto.MonitorResponse

Get returns the current monitor data, don't use this, data is not thread safe Using RegisterChannel and UnRegisterChannel instead

func (*Monitor) RegisterChannel

func (c *Monitor) RegisterChannel(id string, channel chan *proto.MonitorResponse)

func (*Monitor) Round

func (c *Monitor) Round(num float64) int

func (*Monitor) Start

func (c *Monitor) Start()

func (*Monitor) Stats

func (c *Monitor) Stats() (err error)

func (*Monitor) ToFixed

func (c *Monitor) ToFixed(num float64, precision int) float64

func (*Monitor) UnRegisterChannel

func (c *Monitor) UnRegisterChannel(id string)

type Stat

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

Stat will store CPU time struct

type SysInfo

type SysInfo struct {
	CPU    float64
	Memory float64
}

SysInfo will record cpu and memory data

func GetStat

func GetStat(pid int) (*SysInfo, error)

GetStat will return current system CPU and memory data

Jump to

Keyboard shortcuts

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