system

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const CacheLineSize = max(
	int(unsafe.Sizeof(cpu.CacheLinePad{})),

	64-65*int(unsafe.Sizeof(cpu.CacheLinePad{})),
)

CacheLineSize is the size of a CPU cache line in bytes, or a non-zero estimate if the size is unknown.

Variables

This section is empty.

Functions

func NumCPU

func NumCPU() int

NumCPU returns the number of logical CPUs usable by the current process.

!!Note!! If you are considering using this to scale parallelism with the machine size, use runtime.GOMAXPROCS(0) instead. The latter is better because GOMAXPROCS is reduced with certain test runs (with the race detector); it can also be reduced in containerized environments.

The set of available CPUs is checked by querying the operating system at process startup. Changes to operating system CPU allocation after process startup are not reflected.

Types

This section is empty.

Jump to

Keyboard shortcuts

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