statKit

package
v2.1.39 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustSetup added in v2.1.38

func MustSetup(logPath string)

func PrintStats added in v2.1.38

func PrintStats(logger *logrus.Logger)

func Setup added in v2.1.38

func Setup(logPath string) error

Types

type CpuStats

type CpuStats struct {
	Usage      float64 `json:"usage,omitempty"`
	UsageError error   `json:"usageError,omitempty"`
}

type DiskStats added in v2.1.39

type DiskStats struct {
	Path       string  `json:"path,omitempty"`
	Usage      float64 `json:"usage,omitempty"`
	UsageError error   `json:"usageError,omitempty"`
}

type MachineStats

type MachineStats struct {
	// ProcessCount 进程数
	ProcessCount      int   `json:"processCount,omitempty"`
	ProcessCountError error `json:"processCountError,omitempty"`

	// ProcessThreadCount 进程数(包括线程数)
	ProcessThreadCount      int   `json:"processThreadCount,omitempty"`
	ProcessThreadCountError error `json:"processThreadCountError,omitempty"`

	MemoryStatsError error   `json:"memoryStatsError,omitempty"`
	Total            string  `json:"total,omitempty"`
	Available        string  `json:"available,omitempty"`
	Used             string  `json:"used,omitempty"`
	UsedPercent      float64 `json:"usedPercent,omitempty"`
	Free             string  `json:"free,omitempty"`
}

type ProgramStats

type ProgramStats struct {
	GoroutineCount int `json:"goroutineCount"`

	Alloc      string `json:"alloc"`
	TotalAlloc string `json:"totalAlloc"`
	Sys        string `json:"sys"`
	NumGC      uint32 `json:"numGC"`
	EnableGC   bool   `json:"enableGC"`
}

type Stats

type Stats struct {
	Cpu *CpuStats `json:"cpu"`

	Disk *DiskStats `json:"disk"`

	Program *ProgramStats `json:"program"`

	Machine *MachineStats `json:"machine"`
}

func GetStats

func GetStats() (rst *Stats)

GetStats

PS: 由于获取CPU使用率耗时较长,使用 sync.WaitGroup.

Jump to

Keyboard shortcuts

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