Skip to content

runtime #

Description:

runtime provides access to functions describing the current platform:

  • whether it is 32bit or 64bit
  • how many CPUs/cores are available
  • whether the platform is little endian or big endian
  • etc.

fn is_32bit #

fn is_32bit() bool

is_32bit returns true if the current executable is running on a 32 bit system.

fn is_64bit #

fn is_64bit() bool

is_64bit returns true if the current executable is running on a 64 bit system.

fn is_big_endian #

fn is_big_endian() bool

is_big_endian returns true if the current executable is running on a big-endian system.

fn is_little_endian #

fn is_little_endian() bool

is_little_endian returns true if the current executable is running on a little-endian system.

fn nr_cpus #

fn nr_cpus() int

nr_cpus returns the number of virtual CPU cores found on the system.

fn nr_jobs #

fn nr_jobs() int

nr_jobs returns the same as nr_cpus with the difference that if an environment variable VJOBS is set, and has a value > 0, then nr_jobs will return that number instead.
This is useful for runtime tweaking of e.g. threaded or concurrent code.