{"id":1363,"date":"2026-01-14T22:21:33","date_gmt":"2026-01-14T22:21:33","guid":{"rendered":"https:\/\/monkey.ploogie.co.uk\/?page_id=1363"},"modified":"2026-01-14T22:21:33","modified_gmt":"2026-01-14T22:21:33","slug":"mwnci-pidmem-function","status":"publish","type":"page","link":"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-pidmem-function\/","title":{"rendered":"Mwnci pidmem() Function"},"content":{"rendered":"<h2>Syntax<\/h2>\n<p>pidmem<strong>(<em>string<\/em>)<\/strong><\/p>\n<h2>Description<\/h2>\n<p>The <i>pidmem()<\/i> function returns a hash keyed on process id&#8217;s, containing a process name, it&#8217;s cpu\/memory percentage, and process owner uid.<\/p>\n<p>If a process name is given, then only data for that process name is returned<\/p>\n<h2>Example<\/h2>\n<pre>include(\"sysstat\")\r\nData=pidmem()\r\nprintln(Data)\r\nData=pidmem(\"Xorg\")\r\nforeach Pid in keys(Data) {\r\n    PInfo=Data[Pid]\r\n    printf(\"Proc %d Mem Used: %.2f Cpu Used:  %.2f   Command: %s\\n\", Pid, PInfo[\"pc_mem\"], PInfo[\"pc_cpu\"], PInfo[\"command\"])\r\n}\r\n\r\n{1664: {\"command\": \"\/usr\/libexec\/xdg-desktop-portal-gtk\", \"uid\": 1000, \"pc_cpu\": 0, \"pc_mem\": 0.2}, 269139: {\"uid\": 0, \"pc_cpu\": 0, \"pc_mem\": 0, \"command\": \"\/usr\/sbin\/cupsd\"}, 333828: {\"pc_mem\": 0, \"command\": \"systemd-userwork:\", \"uid\": 0, \"pc_cpu\": 0}, 1942: {\"pc_mem\": 0.3, \"command\": \"\/usr\/libexec\/evolution-source-registry\", \"uid\": 1000, \"pc_cpu\": 0}, 1134: {\"uid\": 0, \"pc_cpu\": 0, \"pc_mem\": 0, \"command\": \"\/usr\/sbin\/agetty\"}, 752: {\"uid\": 0, \"pc_cpu\": 0, \"pc_mem\": 0, \"command\": \"\/usr\/sbin\/wpa_supplicant\"}, 1769: {\"command\": \"mate-volume-control-status-icon\", \"uid\": 1000, \"pc_cpu\": 0, \"pc_mem\": 0.2}, 1898: {\"uid\": 1000, \"pc_cpu\": 0, \"pc_mem\": 0, \"command\": \"\/usr\/libexec\/goa-identity-service\"}, 328715: {\"uid\": 1000, \"pc_cpu\": 0, \"pc_mem\": 0, \"command\": \"\/usr\/bin\/bash\"}, 1917: {\"uid\": 1000, \"pc_cpu\": 0, \"pc_mem\": 0, \"command\": \"\/usr\/libexec\/gvfsd-trash\"}, 1783: {\"uid\": 1000, \"pc_cpu\": 0, \"pc_mem\": 0.2, \"command\": \"nm-applet\"}, 1619: {\"pc_mem\": 0.1, \"command\": \"\/usr\/libexec\/xdg-desktop-portal\", \"uid\": 1000, \"pc_cpu\": 0}, 1551: {\"uid\": 1000, \"pc_cpu\": 0, \"pc_mem\": 0, \"command\": \"\/usr\/bin\/ibus-daemon\"} .............}\r\n\r\n\r\nProc 1131 Mem Used: 0.90 Cpu Used:  0.80   Command: \/usr\/lib\/xorg\/Xorg\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Syntax pidmem(string) Description The pidmem() function returns a hash keyed on process id&#8217;s, containing a process name, it&#8217;s cpu\/memory percentage, and process owner uid. If a process name is given, then only data for that process name is returned Example include(&#8220;sysstat&#8221;) Data=pidmem() println(Data) Data=pidmem(&#8220;Xorg&#8221;) foreach Pid in keys(Data) { PInfo=Data[Pid] printf(&#8220;Proc %d Mem Used: %.2f &hellip; <a href=\"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-pidmem-function\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mwnci pidmem() 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-1363","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/1363","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=1363"}],"version-history":[{"count":1,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/1363\/revisions"}],"predecessor-version":[{"id":1364,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/1363\/revisions\/1364"}],"wp:attachment":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=1363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}