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
  • total/free physical memory
  • whether the platform is little endian or big endian
  • etc.

fn free_memory #

fn free_memory() usize

free_memory returns free physical memory found on the system.

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.

fn total_memory #

fn total_memory() usize

total_memory returns total physical memory found on the system.