gsysinfo

package
v0.0.0-...-047dcd9 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DesktopDir

func DesktopDir() (string, error)

func ForbiddenCentOs5x

func ForbiddenCentOs5x() error

Golang does not support CentOS 5.x

func GetAllUsedPercent

func GetAllUsedPercent(duration time.Duration) ([]float64, error)

获取所有CPU的使用百分比,以数组返回

func GetAppBinFolder

func GetAppBinFolder(name string) string

func GetAppLogFolder

func GetAppLogFolder(name string) string

Windows: Linux: MacOS: ~/Library/items/<App>

func GetCombinedUsedPercent

func GetCombinedUsedPercent(duration time.Duration) (float64, error)

获取所有CPU的使用百分比,组合成总百分比后返回

func GetCpuCount

func GetCpuCount() int

func GetEnv

func GetEnv(key string) string

func GetGoPath

func GetGoPath() (string, error)

func GetGoRoot

func GetGoRoot() (string, error)

func GetHomeDir

func GetHomeDir() (string, error)

Home returns the home directory for the executing user.

This uses an OS-specific method for discovering the home directory. An error is returned if a home directory cannot be detected.

func GetSerialNumber

func GetSerialNumber() (string, error)

Get unique serial number of CPU

func GetSharedUserDir

func GetSharedUserDir() (string, error)

func GetSocketLimit

func GetSocketLimit() uint32

func GetSystemLang

func GetSystemLang()

func GetSystemProxy

func GetSystemProxy() (string, bool, error)

func GetTimeWaitRecycle

func GetTimeWaitRecycle() bool

func GetTimeWaitReuse

func GetTimeWaitReuse() bool

func SetEnv

func SetEnv(key, value string) error

func SetSocketLimit

func SetSocketLimit(size uint32)

func SetSystemLang

func SetSystemLang()

func SetSystemProxy

func SetSystemProxy(defaultServer string, enabled bool) error

func SetTimeWaitRecycle

func SetTimeWaitRecycle(onoff bool)

echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle

func SetTimeWaitReuse

func SetTimeWaitReuse(onoff bool)

echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse

func SysRootDir

func SysRootDir() (string, error)

func UpDuration

func UpDuration() (time.Duration, error)

NOTICE: accurate to second only.

func UpTime

func UpTime() (time.Time, error)

Types

type DyncSleep

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

控制CPU使用率,动态调整sleep时间

func NewDyncSleep

func NewDyncSleep(cpuUsage float64) (*DyncSleep, error)

func (*DyncSleep) Sleep

func (s *DyncSleep) Sleep()

type SysVer

type SysVer struct {
	PlatformName    string // windows / linux / darwin
	PlatformVer     string // Under linux this is kernel version
	Arch            string // i386 / AMD64 / ARM / MIPS
	LinuxDistroName string // "CentOS" / "Debian"
	LinuxDistroVer  string
}

func Get

func Get() (*SysVer, error)

func (SysVer) String

func (sv SysVer) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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