Return to index

system functions

CPUInfo = cpu_info([core_number|options])

top

Returns CPU information. Optional core number or options map(.core 0, .details true)

Example:

# Example for cpu_info
println cpu_info()


[]DiskIOStats = dio([device_name|options])

top

Returns disk I/O throughput statistics. Options: map(.device "sda") or simple string for device name.

Example:

# Example for dio
dio()  # usage


[]map = disk_usage([options])

top

Returns filesystem usage information. Options: map(.exclude_patterns ["tmpfs", "proc"])

Example:

# Example for disk_usage
disk_usage()  # usage


map = iodiff(snapshot1,snapshot2,duration)

top

Calculates throughput rates between two snapshots.

Example:

# Example for iodiff
r1 = sys_resources()
r2 = sys_resources()
try
    println iodiff(r1, r2, 1)
catch err
    println "iodiff requires proper duration type"
endtry


MemoryInfo = mem_info()

top

Returns detailed memory information, if available.

Example:

# Example for mem_info
println mem_info()


[]map = mount_info([options])

top

Returns mount point information. Options: map(.filesystem "ext4")

Example:

# Example for mount_info
mount_info()  # usage


[]map = net_devices([options])

top

Returns network device information. Options: map(.all true)

Example:

# Example for net_devices
println net_devices()


[]NetworkIOStats = nio([interface_name|options])

top

Returns network I/O throughput statistics. Options: map(.interface "eth0", .include_errors true) or simple string for interface name.

Example:

# Example for nio
nio()  # usage


[]int = pgrep(pattern)

top

Return PIDs of processes whose name contains the pattern (substring match).

Example:

# Example for pgrep
println pgrep("bash")


int = pkill(pattern[,signal])

top

Send signal to processes whose name contains the pattern. Returns count of processes signalled. Default signal is TERM.

Example:

# Example for pkill
println pkill("test")


ProcessInfo = ps_info(pid[,options])

top

Returns detailed process information. Options: map(.include_environ false)

Example:

# Example for ps_info
println ps_info(pid())


ProcessMap = ps_map([pid])

top

Returns process relationships. Optional starting PID, defaults to root.

Example:

# Example for ps_map
println ps_map()


ProcessTree = ps_tree([pid])

top

Returns process hierarchy. Optional starting PID, defaults to root.

Example:

# Example for ps_tree
println ps_tree()


ResourceUsage = resource_usage(pid)

top

Returns resource usage for specific process.

Example:

# Example for resource_usage
println resource_usage(pid())


bool = send_signal(pid,signal_name_or_number)

top

Sends a signal to a process. Returns true on success. Returns false on permission denied or process not found. Signal can be a name (e.g. "TERM", "KILL", "INT", "HUP") or an integer.


map = sys_load()

top

Returns system load averages (1, 5, 15 minute).

Example:

# Example for sys_load
println sys_load()


SystemResources = sys_resources()

top

Returns overall system resource usage.

Example:

# Example for sys_resources
println sys_resources()


[]ProcessInfo = top_cpu(int)

top

Returns top N CPU consumers (processes). Use -1 for ALL processes.

Example:

# Example for top_cpu
println top_cpu(5)


[]DiskIOStats = top_dio(int)

top

Returns top N disk I/O consumers (devices). Use -1 for ALL devices.

Example:

# Example for top_dio
println top_dio(5)


[]ProcessInfo = top_mem(int)

top

Returns top N memory consumers (processes). Use -1 for ALL processes.

Example:

# Example for top_mem
println top_mem(5)


[]NetworkIOStats = top_nio(int)

top

Returns top N network consumers (interfaces). Use -1 for ALL interfaces.

Example:

# Example for top_nio
println top_nio(5)