Files
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
903b77efbd Bump the opentelemetry-collector group with 4 updates (#5530)
Bumps the opentelemetry-collector group with 4 updates: [go.opentelemetry.io/collector/exporter/otlpexporter](https://github.com/open-telemetry/opentelemetry-collector), [go.opentelemetry.io/collector/exporter/otlphttpexporter](https://github.com/open-telemetry/opentelemetry-collector), [go.opentelemetry.io/collector/otelcol](https://github.com/open-telemetry/opentelemetry-collector) and [go.opentelemetry.io/collector/receiver/otlpreceiver](https://github.com/open-telemetry/opentelemetry-collector).


Updates `go.opentelemetry.io/collector/exporter/otlpexporter` from 0.131.0 to 0.132.0
- [Release notes](https://github.com/open-telemetry/opentelemetry-collector/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CHANGELOG-API.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-collector/compare/v0.131.0...v0.132.0)

Updates `go.opentelemetry.io/collector/exporter/otlphttpexporter` from 0.131.0 to 0.132.0
- [Release notes](https://github.com/open-telemetry/opentelemetry-collector/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CHANGELOG-API.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-collector/compare/v0.131.0...v0.132.0)

Updates `go.opentelemetry.io/collector/otelcol` from 0.131.0 to 0.132.0
- [Release notes](https://github.com/open-telemetry/opentelemetry-collector/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CHANGELOG-API.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-collector/compare/v0.131.0...v0.132.0)

Updates `go.opentelemetry.io/collector/receiver/otlpreceiver` from 0.131.0 to 0.132.0
- [Release notes](https://github.com/open-telemetry/opentelemetry-collector/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CHANGELOG-API.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-collector/compare/v0.131.0...v0.132.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/collector/exporter/otlpexporter
  dependency-version: 0.132.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: opentelemetry-collector
- dependency-name: go.opentelemetry.io/collector/exporter/otlphttpexporter
  dependency-version: 0.132.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: opentelemetry-collector
- dependency-name: go.opentelemetry.io/collector/otelcol
  dependency-version: 0.132.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: opentelemetry-collector
- dependency-name: go.opentelemetry.io/collector/receiver/otlpreceiver
  dependency-version: 0.132.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: opentelemetry-collector
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-19 14:52:28 +02:00
..

numcpus

Go Reference GitHub Action Status

Package numcpus provides information about the number of CPUs in the system.

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

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

On BSD systems, the information is retrieved using the hw.ncpu and hw.ncpuonline sysctls, if supported.

Not all functions are supported on Darwin, FreeBSD, NetBSD, OpenBSD, DragonflyBSD and Solaris/Illumos. ErrNotSupported is returned in case a function is not supported on a particular platform.

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