Mwnci procstat() Function

Syntax

procstat(integer)

Description

The procstat() function returns a hash of the process in a simpler way to process(). An integer can be given to the function to search for a specific process id. If the specified process id is not found a null is returned, other wise a hash of the specified process id is returned. If no process id is given, a hash of the full process table is returned keyed on the process id.

Example

include("ps")
Data=procstat(1)
println(Data)
Data=procstat()
println(Data[1000])
println(Data)


{"pcpu": 0, "pmem": 0.2, "uid": 0, "user": "root", "cmd": "/sbin/init"}
null
{"447": {"uid": 0, "user": "root", "cmd": "/usr/lib/snapd/snapd", "pcpu": 0, "pmem": 0.6}, "29878": {"pcpu": 0, "pmem": 0.1, "uid": 1001, "user": "afry", "cmd": "sshd:"}, "193": {"user": "root", "cmd": "/lib/systemd/systemd-udevd", "pcpu": 0, "pmem": 0.1, "uid": 0}, "462": {"pcpu": 0, "pmem": 0, "uid": 65534, "user": "nobody", "cmd": "/usr/sbin/thd"}, "411": {"cmd": "avahi-daemon:", "pcpu": 0, "pmem": 0, "uid": 108, "user": "avahi"}, "412": {"pcpu": 0, "pmem": 0, "uid": 104, "user": "message+", "cmd": "/usr/bin/dbus-daemon"},
...
...
}