Module cpu

Lua interface to Linux CPU abstractions.

Functions

foreach_online (callback) Calls a function for each online CPU.
foreach_possible (callback) Calls a function for each possible CPU.
foreach_present (callback) Calls a function for each present CPU.
num_online ()
num_possible ()
num_present ()
stats (cpu) Returns CPU time statistics for a given CPU.


Functions

foreach_online (callback)
Calls a function for each online CPU.

Parameters:

  • callback function called with the CPU number
foreach_possible (callback)
Calls a function for each possible CPU.

Parameters:

  • callback function called with the CPU number
foreach_present (callback)
Calls a function for each present CPU.

Parameters:

  • callback function called with the CPU number
num_online ()

Returns:

    integer number of online CPUs
num_possible ()

Returns:

    integer number of possible CPUs
num_present ()

Returns:

    integer number of present CPUs
stats (cpu)
Returns CPU time statistics for a given CPU.

Parameters:

  • cpu integer CPU number (0-based)

Returns:

    table fields: user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice, forceidle (if CONFIGSCHEDCORE)

Raises:

if CPU is offline
generated by LDoc 1.5.0 Last updated 2026-03-31 12:21:45