# std/cpuinfo

Dark Mode

- Manual
- Standard library
- Index
- Compiler docs
- Fusion docs
- devel, stable

Search:
Source Edit

This module implements a proc to determine the number of CPUs / cores.

Example:

    import std/cpuinfo
    doAssert countProcessors() > 0

# Imports

posix

# Procs

    proc countProcessors(): int {....gcsafe, extern: "ncpi$1", raises: [], tags: [].}

  Returns the number of the processors/cores the machine has. Returns 0 if it cannot be detected. Source Edit