sysinfo

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBType

type DBType string

DBType represents the database workload type

const (
	DBTypeWeb     DBType = "web"
	DBTypeOLTP    DBType = "oltp"
	DBTypeDW      DBType = "dw"
	DBTypeDesktop DBType = "desktop"
	DBTypeMixed   DBType = "mixed"
)

type DiskType

type DiskType string

DiskType represents the type of storage device

const (
	DiskSSD DiskType = "ssd"
	DiskHDD DiskType = "hdd"
	DiskSAN DiskType = "san"
)

type OSType

type OSType string

OSType represents the operating system type

const (
	OSLinux   OSType = "linux"
	OSWindows OSType = "windows"
	OSMac     OSType = "mac"
)

type SystemInfo

type SystemInfo struct {
	// TotalMemoryBytes is the total system memory in bytes
	TotalMemoryBytes uint64

	// CPUCount is the number of logical CPUs
	CPUCount int

	// OSType is the operating system type
	OSType OSType

	// PostgreSQLVersion is the PostgreSQL major version
	PostgreSQLVersion float64

	// DiskType is the detected or assumed disk type
	DiskType DiskType

	// IsContainer indicates if running inside a container
	IsContainer bool

	// ContainerMemory is the container memory limit in bytes (0 if not limited)
	ContainerMemory uint64
}

SystemInfo contains detected system information

func DetectSystemInfo

func DetectSystemInfo() (*SystemInfo, error)

DetectSystemInfo automatically detects system information

func (*SystemInfo) String

func (si *SystemInfo) String() string

String returns a human-readable representation of the system info

func (*SystemInfo) TotalMemoryGB

func (si *SystemInfo) TotalMemoryGB() float64

TotalMemoryGB returns total memory in GB

func (*SystemInfo) TotalMemoryKB

func (si *SystemInfo) TotalMemoryKB() uint64

TotalMemoryKB returns total memory in KB

func (*SystemInfo) TotalMemoryMB

func (si *SystemInfo) TotalMemoryMB() float64

TotalMemoryMB returns total memory in MB

Jump to

Keyboard shortcuts

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