{"id":1127,"date":"2025-05-19T14:51:33","date_gmt":"2025-05-19T13:51:33","guid":{"rendered":"https:\/\/monkey.ploogie.co.uk\/?page_id=1127"},"modified":"2025-05-19T15:03:14","modified_gmt":"2025-05-19T14:03:14","slug":"mwnci-procstat-function","status":"publish","type":"page","link":"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-procstat-function\/","title":{"rendered":"Mwnci procstat() Function"},"content":{"rendered":"<h2>Syntax<\/h2>\n<p>procstat<strong>(<em>integer<\/em>)<\/strong><\/p>\n<h2>Description<\/h2>\n<p>The <i>procstat()<\/i> function returns a hash  of the process in a simpler way to <b>process()<\/b>.  An integer can be given to the function to search for a specific process id.  If the specified process id is not found a <em>null<\/em> 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.<\/p>\n<h2>Example<\/h2>\n<pre>include(\"ps\")\r\nData=procstat(1)\r\nprintln(Data)\r\nData=procstat()\r\nprintln(Data[1000])\r\nprintln(Data)\r\n\r\n\r\n{\"pcpu\": 0, \"pmem\": 0.2, \"uid\": 0, \"user\": \"root\", \"cmd\": \"\/sbin\/init\"}\r\nnull\r\n{\"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\"},\r\n...\r\n...\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-procstat-function\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mwnci procstat() Function&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1127","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/1127","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=1127"}],"version-history":[{"count":3,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/1127\/revisions"}],"predecessor-version":[{"id":1130,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/1127\/revisions\/1130"}],"wp:attachment":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=1127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}