Documentation ¶
Index ¶
- func GetIpInNetworkType(netWorkAddr string) (string, string)
- type BaseInfo
- type Config
- type IOInfo
- type NetworkIOInfo
- type NetworkInfo
- type ProcessCpuInfo
- type Psutil
- func (p *Psutil) GetBaseInfo() (info BaseInfo, err error)
- func (p *Psutil) GetLocalIP() (ip string, err error)
- func (p *Psutil) GetNetworkInfo() (networkInfo NetworkInfo)
- func (p *Psutil) GetNetworkIpType(netWorkAddr string) (string, string)
- func (p *Psutil) GetNetworkRate() (rates NetworkInfo, err error)
- func (p *Psutil) GetThreadCpuInfo() (info ProcessCpuInfo, err error)
- func (p *Psutil) GetThreadMemoryUsage() UsageInfo
- func (p *Psutil) GetUsageInfo(bNum uint64) UsageInfo
- type RateInfo
- type UsageInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetIpInNetworkType ¶ added in v0.1.3
GetIpInNetworkType 获取在网络地址中的IP的分类。 网络地址示例1:fe80::4d90:6461:8e7e:2870/64 网络地址示例2:10.1.3.12/24 @return 返回(IP地址,IP类型)
Types ¶
type BaseInfo ¶ added in v0.1.4
type BaseInfo struct { MemoryUsedPercent float64 `json:"memory_used_percent"` // 内存使用百分比 MemoryTotal uint64 `json:"memory_total"` // 总内存 MemoryFree uint64 `json:"memory_free"` // 可用内存 CpuUsedPercent float64 `json:"cpu_used_percent"` // CPU使用百分比 Platform string `json:"platform"` // 平台 Family string `json:"family"` // 类别 Version string `json:"version"` // 版本 CpuNum int `json:"cpu_num"` // CPU数量 }
BaseInfo 基础信息
type IOInfo ¶ added in v0.1.3
type IOInfo struct { SendBytes uint64 `json:"send_bytes"` // 发送字节数 ReceiveBytes uint64 `json:"receive_bytes"` // 接收字节数 }
IOInfo 读写信息
type ProcessCpuInfo ¶ added in v0.1.1
type ProcessCpuInfo struct { AllCpuPercent float64 `json:"all_cpu_percent"` // 占用所有CPU的百分比 SingleCpuPercent float64 `json:"single_cpu_percent"` // 占用所有单个CPU的百分比 ProcessMemoryPercent float32 `json:"process_memory_percent"` // 进程占用内存百分比 ThreadNumber int `json:"thread_number"` // 创建的线程数量 CpuNumber int `json:"cpu_number"` // CPU的数量 GoroutineNumber int `json:"goroutine_number"` // 创建的goroutine数量 }
ProcessCpuInfo CPU 信息
type Psutil ¶
type Psutil struct {
Config *Config // 配置对象
}
func NewWithConfig ¶ added in v0.1.3
func (*Psutil) GetBaseInfo ¶ added in v0.1.4
GetBaseInfo 获取基本信息
func (*Psutil) GetLocalIP ¶ added in v0.1.3
GetLocalIP 获取本地IP地址
func (*Psutil) GetNetworkInfo ¶ added in v0.1.3
func (p *Psutil) GetNetworkInfo() (networkInfo NetworkInfo)
GetNetworkInfo 获取网卡信息
func (*Psutil) GetNetworkIpType ¶ added in v0.1.3
GetNetworkIpType 获取在网络地址中的IP的分类,返回IP地址和IP分类类型
func (*Psutil) GetNetworkRate ¶ added in v0.1.3
func (p *Psutil) GetNetworkRate() (rates NetworkInfo, err error)
GetNetworkRate 获取网卡速率信息
func (*Psutil) GetThreadCpuInfo ¶ added in v0.1.3
func (p *Psutil) GetThreadCpuInfo() (info ProcessCpuInfo, err error)
func (*Psutil) GetThreadMemoryUsage ¶ added in v0.1.3
GetThreadMemoryUsage 获取当前进程的内存使用信息
func (*Psutil) GetUsageInfo ¶ added in v0.1.3
GetUsageInfo 获取使用信息
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
gopsutil
|
|
Package numcpus provides information about the number of CPUs in the system.
|
Package numcpus provides information about the number of CPUs in the system. |
Package sysconf implements the sysconf(3) function and provides the associated SC_* constants to query system configuration values.
|
Package sysconf implements the sysconf(3) function and provides the associated SC_* constants to query system configuration values. |
Package wmi provides a WQL interface for WMI on Windows.
|
Package wmi provides a WQL interface for WMI on Windows. |
Click to show internal directories.
Click to hide internal directories.