Manuscript Documentation
v2026.12.0

@std/os/system.ms#

Import each required symbol with import Name from "@std/os/system.ms".

CpuInfo Type#

Model, integer MHz speed (fractional MHz truncated), and cumulative integer millisecond counters for one logical CPU. irq includes hardware and software interrupt time.

Manuscript
type CpuInfo {
    model String
    speed_mhz Int
    user Int
    nice Int
    system Int
    idle Int
    irq Int
}

CpuInfo.idle#

Cumulative milliseconds this logical CPU spent idle.

Manuscript
idle Int

CpuInfo.irq#

Cumulative milliseconds this logical CPU spent servicing hardware and software interrupts.

Manuscript
irq Int

CpuInfo.model#

Marketing name of the processor, such as Intel(R) Core(TM) i7; it can be empty where the host does not report one.

Manuscript
model String

CpuInfo.nice#

Cumulative milliseconds this logical CPU spent running low-priority (niced) user processes.

Manuscript
nice Int

CpuInfo.speed_mhz#

Integer megahertz, not a time interval.

Manuscript
speed_mhz Int

CpuInfo.system#

Cumulative milliseconds this logical CPU spent running kernel code.

Manuscript
system Int

CpuInfo.user#

Cumulative milliseconds this logical CPU spent running normal-priority user processes.

Manuscript
user Int

Endianness Enum#

The byte order of the host’s native integers.

Manuscript
enum Endianness {
    Little
    Big
}

Endianness.Big#

The most significant byte comes first.

Manuscript
Big

Endianness.Little#

The least significant byte comes first, as on x86-64 and AArch64.

Manuscript
Little

MemoryUsage Type#

Memory statistics for the current process; every field is bytes.

Manuscript
type MemoryUsage {
    heap_used Int
    heap_total Int
    heap_system Int
    external Int
    resident Int
}

MemoryUsage.external#

Bytes the runtime obtained from the operating system outside the heap, such as stacks and internal tables.

Manuscript
external Int

MemoryUsage.heap_system#

Bytes of heap memory obtained from the operating system, including idle spans.

Manuscript
heap_system Int

MemoryUsage.heap_total#

Bytes of heap spans currently in use, which is at least heap_used.

Manuscript
heap_total Int

MemoryUsage.heap_used#

Bytes of heap memory occupied by live objects and objects not yet collected.

Manuscript
heap_used Int

MemoryUsage.resident#

Bytes of physical memory the operating system reports as resident for the process.

Manuscript
resident Int

NetworkInterface Type#

Address and link metadata for one host network interface.

Manuscript
type NetworkInterface {
    name String
    address String
    netmask String
    family IpFamily
    mac String
    internal Bool
    scope_id Int
}

NetworkInterface.address#

The interface’s IP address in textual form, such as 192.168.1.5 or fe80::1.

Manuscript
address String

NetworkInterface.family#

Whether address is IPv4 or IPv6.

Manuscript
family IpFamily

NetworkInterface.internal#

True for a loopback interface, which only reaches the local host.

Manuscript
internal Bool

NetworkInterface.mac#

Hardware address as colon-separated lowercase hexadecimal, or an empty string for interfaces without one such as loopback.

Manuscript
mac String

NetworkInterface.name#

Host name of the interface, such as eth0 or lo0. Interfaces with several addresses appear once per address.

Manuscript
name String

NetworkInterface.netmask#

The address’s network mask in the same textual form as address, such as 255.255.255.0.

Manuscript
netmask String

NetworkInterface.scope_id#

The operating system’s numeric index for the interface, as used to select an interface for link-local IPv6 addresses.

Manuscript
scope_id Int

Os Enum#

The operating system family the program was built for. A host outside the three named families reads as Other.

Manuscript
enum Os {
    Linux
    Macos
    Windows
    Other
}

Os.Linux#

The program runs on a Linux kernel of any distribution.

Manuscript
Linux

Os.Macos#

The program runs on Apple macOS, which uname reports as Darwin.

Manuscript
Macos

Os.Other#

The host is outside the three named families, such as a BSD.

Manuscript
Other

Os.Windows#

The program runs on Microsoft Windows, where numeric user ids read as -1.

Manuscript
Windows

RuntimeCounts Type#

Work the runtime has done since the program started. Counts only grow, so a benchmark reads them before and after a run and subtracts. They do not depend on machine load or on the host, so a change in them is a real change in the work a program does.

Manuscript
type RuntimeCounts {
    allocations Int
    allocated_bytes Int
    list_copies Int
    list_copy_bytes Int
    string_clones Int
    string_clone_bytes Int
    operations Int
}

RuntimeCounts.allocated_bytes#

Bytes those allocations asked for.

Manuscript
allocated_bytes Int

RuntimeCounts.allocations#

Allocations the runtime made. Covers the calling thread and every thread that has finished; a thread still running is not included.

Manuscript
allocations Int

RuntimeCounts.list_copies#

Lists copied element by element, from the calling isolate.

Manuscript
list_copies Int

RuntimeCounts.list_copy_bytes#

Bytes those list copies moved.

Manuscript
list_copy_bytes Int

RuntimeCounts.operations#

MIR operations the program executed: its own code, not the runtime beneath it. Counted only in a build made for it (ms bench --ops); zero otherwise.

Manuscript
operations Int

RuntimeCounts.string_clone_bytes#

Bytes those string clones moved.

Manuscript
string_clone_bytes Int

RuntimeCounts.string_clones#

Strings cloned, from the calling isolate.

Manuscript
string_clones Int

SystemInfo Type#

Operating system and processor architecture for the current host.

Manuscript
type SystemInfo {
    os String
    architecture String
    cpu_count Int
}

SystemInfo.architecture#

The processor architecture in common naming, such as amd64, arm64, or 386.

Manuscript
architecture String

SystemInfo.cpu_count#

Number of logical CPUs the operating system reports as present for this process.

Manuscript
cpu_count Int

SystemInfo.os#

Operating system name, such as linux, darwin, or windows. Hosts outside those families report their own name; os() returns the three named families as an enum.

Manuscript
os String

SystemMetrics Type#

Host measurements: memory fields are bytes; load_average is 1/5/15-minute load (three zeros on Windows); available_parallelism is a usable logical-processor count.

Manuscript
type SystemMetrics {
    total_memory Int
    free_memory Int
    available_memory Int
    uptime Duration
    load_average List[Float]
    available_parallelism Int
}

SystemMetrics.available_memory#

Estimated physical memory in bytes that new work can use without swapping, including reclaimable caches.

Manuscript
available_memory Int

SystemMetrics.available_parallelism#

Logical processors this process may run on, which can be fewer than SystemInfo.cpu_count under CPU affinity limits.

Manuscript
available_parallelism Int

SystemMetrics.free_memory#

Physical memory in bytes that is completely unused; caches count as used, so it is usually smaller than available_memory.

Manuscript
free_memory Int

SystemMetrics.load_average#

Three Floats for the 1, 5, and 15 minute system load averages; all 0.0 on Windows.

Manuscript
load_average List[Float]

SystemMetrics.total_memory#

Installed physical memory in bytes.

Manuscript
total_memory Int

SystemMetrics.uptime#

Host boot uptime as a Duration with whole-second native resolution; not process uptime.

Manuscript
uptime Duration

UserInfo Type#

User name, numeric identity, home directory, and login shell.

Manuscript
type UserInfo {
    username String
    uid Int
    gid Int
    home String
    shell String
}

UserInfo.gid#

Numeric primary group id of the current user; -1 on Windows, where ids are not numeric.

Manuscript
gid Int

UserInfo.home#

Absolute path of the user’s home directory from the account database.

Manuscript
home String

UserInfo.shell#

Path of the user’s login shell, or an empty string when the host records null.

Manuscript
shell String

UserInfo.uid#

Numeric user id of the current user; -1 on Windows, where ids are not numeric.

Manuscript
uid Int

UserInfo.username#

Login name of the current user.

Manuscript
username String

available_memory Function#

Returns bytes available to new allocations: the host’s available memory, reduced to the remaining headroom when a Linux cgroup memory limit applies.

Manuscript
fn available_memory() Result[Int, Error] { ... }

constants Function#

Returns native signal/error/loader/priority constants by name. Names and values vary by host; missing entries do not imply a portable numeric default.

Manuscript
fn constants() Map[String, Int] { ... }

constrained_memory Function#

Returns the memory limit in bytes imposed on this process by its Linux cgroup, or 0 when no limit applies or the platform has no such limit.

Manuscript
fn constrained_memory() Result[Int, Error] { ... }

cpus Function#

Returns one CpuInfo per logical CPU with its model, clock speed, and cumulative time counters.

Manuscript
fn cpus() Result[List[CpuInfo], Error] { ... }

dev_null Function#

Returns the conventional null-device path for the host.

Manuscript
fn dev_null() String { ... }

end_of_line Function#

Returns the host’s line-ending sequence.

Manuscript
fn end_of_line() String { ... }

endianness Function#

Returns the host’s native byte order.

Manuscript
fn endianness() Endianness { ... }

hostname Function#

Returns the host’s name as reported by the operating system. A name that is not valid UTF-8 returns ENOTSUP.

Manuscript
fn hostname() Result[String, Error] { ... }

machine Function#

Returns the hardware architecture in uname -m style, such as x86_64, aarch64, or i686; other architectures use the target’s architecture name.

Manuscript
fn machine() Result[String, Error] { ... }

memory_usage Function#

Returns heap and resident memory statistics for this process, in bytes.

Manuscript
fn memory_usage() Result[MemoryUsage, Error] { ... }

metrics Function#

Returns memory sizes in bytes, host uptime, load averages, and available parallelism in one snapshot. A host query failure returns an Error describing it.

Manuscript
fn metrics() Result[SystemMetrics, Error] { ... }

network_interfaces Function#

Returns one NetworkInterface for every address on every interface, including loopback. An interface name that is not valid UTF-8 returns ENOTSUP.

Manuscript
fn network_interfaces() Result[List[NetworkInterface], Error] { ... }

os Function#

Returns the operating system family this program runs on.

Manuscript
fn os() Os { ... }

os_release Function#

Returns the kernel release string, such as 6.1.0-18-amd64, with surrounding whitespace removed. Returns ENOTSUP where the host does not expose it.

Manuscript
fn os_release() Result[String, Error] { ... }

os_version Function#

Returns the kernel build or version string, such as #1 SMP Debian, with surrounding whitespace removed. Returns ENOTSUP where the host does not expose it.

Manuscript
fn os_version() Result[String, Error] { ... }

runtime_counts Function#

Returns the runtime’s work counters: allocations, bytes allocated, and list and string copies.

Manuscript
fn runtime_counts() Result[RuntimeCounts, Error] { ... }

system_info Function#

Returns the operating system name, processor architecture, and logical CPU count for this host.

Manuscript
fn system_info() SystemInfo { ... }

uptime Function#

Returns elapsed Duration since runtime initialization, rather than host boot.

Manuscript
fn uptime() Result[Duration, Error] { ... }

user_info Function#

Returns the current user’s name, numeric ids, home directory, and login shell. The shell is empty when the host does not record one, and text that is not valid UTF-8 returns ENOTSUP.

Manuscript
fn user_info() Result[UserInfo, Error] { ... }