cpu

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package cpu is a library that counts system and process cpu usage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUInfo

type CPUInfo struct {
	ModelName string  `json:"modelName"`
	Cores     int32   `json:"cores"`
	Frequency float64 `json:"frequency"` // cpu frequency, unit(Mhz)
}

CPUInfo cpu information

type Process

type Process struct {
	UsagePercent float64 `json:"usage_percent"` // cpu usage, unit(%)

	RSS uint64 `json:"rss"` // use of physical memory, unit(M)
	VMS uint64 `json:"vms"` // use of virtual memory, unit(M)
}

Process information

func GetProcess

func GetProcess() *Process

GetProcess get current process info

type System

type System struct {
	UsagePercent float64   `json:"usage_percent"` // cpu usage, unit(%)
	CPUInfo      []CPUInfo `json:"cpu_info"`
}

System cpu information

func GetSystemCPU

func GetSystemCPU() *System

GetSystemCPU get system cpu info

Jump to

Keyboard shortcuts

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