{"id":1481,"date":"2019-10-29T16:23:41","date_gmt":"2019-10-29T20:23:41","guid":{"rendered":"https:\/\/www.devolve.net\/?p=1481"},"modified":"2019-10-29T16:23:41","modified_gmt":"2019-10-29T20:23:41","slug":"trying-to-find-the-memory-high-water-mark-for-a-given-process","status":"publish","type":"post","link":"https:\/\/www.devolve.local\/trying-to-find-the-memory-high-water-mark-for-a-given-process\/","title":{"rendered":"Trying to find the memory high water mark for a given process"},"content":{"rendered":"

I wanted to find out the most memory a process used while running. ps_mem.py<\/a> is great for showing the total size (resident + shared) for processes but it’s only an instantaneous snapshot. After some searching, I found out that a tool I’d known about forever already has (mostly) the feature I wanted: \/usr\/bin\/time<\/code>.<\/p>\n

$ \/usr\/bin\/time -v uptime
\n 20:18:17 up 23:19, 5 users, load average: 1.76, 2.30, 2.30
\n\tCommand being timed: \"uptime\"
\n\tUser time (seconds): 0.00
\n\tSystem time (seconds): 0.00
\n\tPercent of CPU this job got: 18%
\n\tElapsed (wall clock) time (h:mm:ss or m:ss): 0:00.04
\n\tAverage shared text size (kbytes): 0
\n\tAverage unshared data size (kbytes): 0
\n\tAverage stack size (kbytes): 0
\n\tAverage total size (kbytes): 0
\n\tMaximum resident set size (kbytes): 3032
\n\tAverage resident set size (kbytes): 0
\n\tMajor (requiring I\/O) page faults: 1
\n\tMinor (reclaiming a frame) page faults: 136
\n\tVoluntary context switches: 5
\n\tInvoluntary context switches: 0
\n\tSwaps: 0
\n\tFile system inputs: 88
\n\tFile system outputs: 0
\n\tSocket messages sent: 0
\n\tSocket messages received: 0
\n\tSignals delivered: 0
\n\tPage size (bytes): 4096
\n\tExit status: 0<\/code><\/p>\n

Not to be confused with the Bash builtin command, \/usr\/bin\/time -v<\/code> will show numerous stats about a process that just finished running, including a line that looks like this: Maximum resident set size (kbytes): 63992<\/code>. While it may not show the resident + shared size like ps_mem.py<\/code>, it’s still very valuable information when trying to figure out if you’re approaching a certain memory limit.<\/p>\n","protected":false},"excerpt":{"rendered":"

I wanted to find out the most memory a process used while running. ps_mem.py is great for showing the total size (resident + shared) for processes but it’s only an instantaneous snapshot. After some searching, I found out that a tool I’d known about forever already has (mostly) the feature I wanted: \/usr\/bin\/time.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[34,25,26],"_links":{"self":[{"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/posts\/1481"}],"collection":[{"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/comments?post=1481"}],"version-history":[{"count":1,"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/posts\/1481\/revisions"}],"predecessor-version":[{"id":1482,"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/posts\/1481\/revisions\/1482"}],"wp:attachment":[{"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/media?parent=1481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/categories?post=1481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/tags?post=1481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}