cpu

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCacheSize

func GetCacheSize(kind CacheKind) int64

GetCacheSize returns the size of the cache.

Types

type CPUData

type CPUData struct {
	// BrandName is the name of the CPU
	BrandName string
	// Cache contains the cache information
	Cache CacheInfo
}

CPUData contains the CPU information

func GetCPUInfo

func GetCPUInfo() *CPUData

GetCPUInfo returns the CPU information

func (*CPUData) Print

func (c *CPUData) Print()

Println prints the CPU information

type CacheInfo

type CacheInfo struct {
	// L1 is the size of the L1 cache in bytes
	L1 int64
	// L2 is the size of the L2 cache in bytes
	L2 int64
	// L3 is the size of the L3 cache in bytes
	L3 int64
}

CacheInfo contains the cache information

func (*CacheInfo) CheckAndEstimate

func (c *CacheInfo) CheckAndEstimate()

CheckAndEstimate checks if the cache sizes are valid and estimates them if they are not

type CacheKind

type CacheKind int

CacheKind is a enum that represents the kind of cache.

const (
	// CacheL1 is the L1 cache.
	CacheL1 CacheKind = 0
	// CacheL2 is the L2 cache.
	CacheL2 CacheKind = 1
	// CacheL3 is the L3 cache.
	CacheL3 CacheKind = 2
)

func GetDefaultCacheTarget

func GetDefaultCacheTarget() CacheKind

GetDefaultCacheTarget returns the default cache target.

func (CacheKind) GetCacheSize

func (ck CacheKind) GetCacheSize() int64

GetCacheSize returns the size of the cache.

func (CacheKind) String

func (ck CacheKind) String() string

String returns the string representation of the cache kind.

Jump to

Keyboard shortcuts

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