platform

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

* Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootTime

func BootTime() (bootime time.Time, err error)

BootTime returns system uptime.

func ConvertError added in v1.18.0

func ConvertError(err error) error

ConvertError converts a platform error into a commonerrors

func Hostname

func Hostname() (string, error)

Hostname returns the hostname.

func IsWindows

func IsWindows() bool

IsWindows checks whether we are running on Windows or not.

func LineSeparator

func LineSeparator() string

LineSeparator returns the line separator.

func NodeName

func NodeName() (nodename string, err error)

NodeName returns the system node name (equivalent to uname -n).

func PlatformInformation

func PlatformInformation() (information string, err error)

PlatformInformation returns the platform information (equivalent to uname -s).

func SystemInformation

func SystemInformation() (information string, err error)

SystemInformation returns the system information (equivalent to uname -a)

func Uname

func Uname() (string, error)

func UnixLineSeparator added in v1.1.0

func UnixLineSeparator() string

UnixLineSeparator returns the line separator on Unix platform.

func UpTime

func UpTime() (uptime time.Duration, err error)

UpTime returns system uptime.

Types

type RAM

type RAM interface {
	// GetTotal returns total amount of RAM on this system
	GetTotal() uint64
	// GetAvailable returns RAM available for programs to allocate
	GetAvailable() uint64
	// GetUsed returns RAM used by programs
	GetUsed() uint64
	// GetUsedPercent returns Percentage of RAM used by programs
	GetUsedPercent() float64
	// GetFree returns kernel's notion of free memory
	GetFree() uint64
}

func GetRAM

func GetRAM() (ram RAM, err error)

type VirtualMemory

type VirtualMemory struct {
	Total       uint64
	Available   uint64
	Used        uint64
	UsedPercent float64
	Free        uint64
}

func (*VirtualMemory) GetAvailable

func (m *VirtualMemory) GetAvailable() uint64

func (*VirtualMemory) GetFree

func (m *VirtualMemory) GetFree() uint64

func (*VirtualMemory) GetTotal

func (m *VirtualMemory) GetTotal() uint64

func (*VirtualMemory) GetUsed

func (m *VirtualMemory) GetUsed() uint64

func (*VirtualMemory) GetUsedPercent

func (m *VirtualMemory) GetUsedPercent() float64

Jump to

Keyboard shortcuts

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