status-go/vendor/github.com/tklauser/numcpus
Andrea Maria Piana 2f539d3bd2 Upgrade go-ens
Go ens needs to be updated to be compatible with the lastest geth
version
2021-07-20 10:57:38 +02:00
..
.cirrus.yml Upgrade go-ens 2021-07-20 10:57:38 +02:00
LICENSE Upgrade go-ens 2021-07-20 10:57:38 +02:00
README.md Upgrade go-ens 2021-07-20 10:57:38 +02:00
go.mod Upgrade go-ens 2021-07-20 10:57:38 +02:00
go.sum Upgrade go-ens 2021-07-20 10:57:38 +02:00
numcpus.go Upgrade go-ens 2021-07-20 10:57:38 +02:00
numcpus_bsd.go Upgrade go-ens 2021-07-20 10:57:38 +02:00
numcpus_linux.go Upgrade go-ens 2021-07-20 10:57:38 +02:00
numcpus_solaris.go Upgrade go-ens 2021-07-20 10:57:38 +02:00
numcpus_unsupported.go Upgrade go-ens 2021-07-20 10:57:38 +02:00

README.md

numcpus

Go Reference GitHub Action Status Go Report Card

Package numcpus provides information about the number of CPU.

It gets the number of CPUs (online, offline, present, possible or kernel maximum) on a Linux, Darwin, FreeBSD, NetBSD, OpenBSD, DragonflyBSD or Solaris/Illumos system.

On Linux, the information is retrieved by reading the corresponding CPU topology files in /sys/devices/system/cpu.

Not all functions are supported on Darwin, FreeBSD, NetBSD, OpenBSD, DragonflyBSD and Solaris/Illumos.

Usage

package main

import (
	"fmt"
	"os"

	"github.com/tklauser/numcpus"
)

func main() {
	online, err := numcpus.GetOnline()
	if err != nil {
		fmt.Fprintf(os.Stderr, "GetOnline: %v\n", err)
	}
	fmt.Printf("online CPUs: %v\n", online)

	possible, err := numcpus.GetPossible()
	if err != nil {
		fmt.Fprintf(os.Stderr, "GetPossible: %v\n", err)
	}
	fmt.Printf("possible CPUs: %v\n", possible)
}

References