sysinfo

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2025 License: ISC Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CPUInfo

func CPUInfo() (cores int, used, free float64, err error)

CPUInfo retrieves the number of CPU cores, the CPU usage percentage, and calculates the used and free CPU percentages. It returns the number of cores, used percentage, free percentage, and an error if any occurs.

func DiskInfo

func DiskInfo() (total, used, free uint64, err error)

DiskInfo retrieves disk usage statistics for the root directory ("/"). It returns the total, used, and free disk space in bytes, along with any error encountered.

func MemoryInfo

func MemoryInfo() (total, used, free uint64, err error)

MemoryInfo retrieves the system's memory statistics. It returns the total, used, and free memory in bytes, along with any error encountered.

func NetworkInfo

func NetworkInfo() (sent, recv uint64, err error)

NetworkInfo retrieves the total bytes sent and received on the network interfaces. It returns the number of bytes sent, bytes received, and an error if any occurs.

func Uptime

func Uptime() (time.Duration, error)

Uptime retrieves the system uptime and returns it as a time.Duration. It returns an error if the uptime cannot be determined.

func UptimeI18n

func UptimeI18n(dayTitle, hourTitle, minuteTitle, separator string) (string, error)

UptimeI18n retrieves the system uptime and formats it as a localized string. The titles for days, hours, and minutes, as well as the separator, are provided as arguments.

func UptimeParts

func UptimeParts() (days, hours, minutes uint64, err error)

UptimeParts retrieves the system uptime and returns it as days, hours, and minutes. It also returns an error if the uptime cannot be determined.

Types

This section is empty.

Jump to

Keyboard shortcuts

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