System operations: time, process identity, node info, exit.

Light wrappers around :erlang and :os BIFs. exit/1 halts the whole BEAM node -- use with care.

Examples

use Std.System

cpu_count()                             # e.g. 8
timestamp_ms() > 0                      # => true
node() == :nonode@nohost                # true without -sname

Functions

  • # fn __group__() -> Atom

    Group tag consumed by Cure.Stdlib.Preload.

  • # fn cpu_count() -> Int

    Number of logical processors available to the VM.

  • # fn exit(code: Int) -> Atom extern

    Halt the whole BEAM node with the given exit status.

  • # fn monotonic_time() -> Int extern

    Native monotonic-time reading in implementation-defined units. Use for measuring durations (a - b is meaningful); not wall-clock.

  • # fn node() -> Atom extern

    Atom name of the local node.

  • # fn otp_version() -> T

    Running OTP release version (as a charlist, per the BIF).

  • # fn self() -> Pid extern

    Pid of the calling process.

  • # fn system_info(key: Atom) -> T extern

    Query the VM with :erlang.system_info/1. Return type depends on key; callers should narrow it via the wrappers below.

  • # fn system_time(unit: Atom) -> Int extern

    OS wall-clock time in unit (typically :second, :millisecond, :microsecond, or :nanosecond).

  • # fn timestamp_ms() -> Int

    Current millisecond timestamp since the Unix epoch.

  • # fn timestamp_us() -> Int

    Current microsecond timestamp since the Unix epoch.