cpu

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 License: MIT Imports: 5 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(%), current process occupies current logical CPU, total usage is cores*UsagePercent

	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(%), current logical CPU usage, total usage is cores*UsagePercent
	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