tag:blogger.com,1999:blog-10678074.post7981061079612882083..comments2024-03-29T05:02:48.371+00:00Comments on making apps, making webs.: Memory usage of processes from python?Unknownnoreply@blogger.comBlogger11125tag:blogger.com,1999:blog-10678074.post-58048513410611398932010-03-14T11:25:38.075+00:002010-03-14T11:25:38.075+00:00ps_mem.py: ' Try to determine how much RAM is ...<a href="http://www.pixelbeat.org/scripts/ps_mem.py" rel="nofollow">ps_mem.py</a>: ' Try to determine how much RAM is currently being used per program.<br /># Note per _program_, not per process. So for example this script<br /># will report RAM used by all httpd process together.'<br /><br />exmap uses a loadable kernel module... but ps_mem.py uses /proc/PID/smaps data from 2.6.23 onwards kernels. So I think it will be more useful overall.<br /><br />David Malcolm wrote a blog post at <a href="http://dmalcolm.livejournal.com/4183.html" rel="nofollow">memory usage: is it worth sharing constant data?</a> related to the OLPC project which wants to reduce memory usage of CPython processes by trying to get all the different processes to share memory.René Dudfieldhttps://www.blogger.com/profile/17762358075557755436noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-1477799885047731202010-03-14T11:05:50.882+00:002010-03-14T11:05:50.882+00:00Found a couple more things...
I found out about /...Found a couple more things...<br /><br />I found out about /proc/PID/smaps which has a lot more memory information compared to /proc/PID/status. There's a few tools which visualise smaps data too.<br /><br /><a href="http://www.berthels.co.uk/exmap/" rel="nofollow">exmap</a>: 'Exmap is a memory analysis tool which allows you to accurately determine how much physical memory and swap is used by individual processes and shared libraries on a running system. In particular, it accounts for the sharing of memory and swap between different processes.'<br /><br />So exmap seems very useful for measuring system level memory usage with python.René Dudfieldhttps://www.blogger.com/profile/17762358075557755436noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-69500797585168842672010-03-13T23:50:05.155+00:002010-03-13T23:50:05.155+00:00you might be interested in RunSnakeRun; there is a...you might be interested in <a href="http://www.vrplumber.com/programming/runsnakerun/" rel="nofollow">RunSnakeRun</a>; there is also a nice <a href="http://us.pycon.org/2009/conference/schedule/event/15/" rel="nofollow">video</a>flowhttps://www.blogger.com/profile/18342392935682557868noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-61196430058885932702010-03-13T09:21:10.079+00:002010-03-13T09:21:10.079+00:00@Jeet: cool, syrupy looks very useful. Looks like...@Jeet: cool, syrupy looks very useful. Looks like it would be easy to convert the output to a pretty graph.<br /><br />@peter: very easy! That's the file being parsed in the memory_usage module.<br /><br />@grib: ah, that's quite nice for inspecting a running program.René Dudfieldhttps://www.blogger.com/profile/17762358075557755436noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-22655677472524345762010-03-12T22:41:20.964+00:002010-03-12T22:41:20.964+00:00We use:
$ cat /proc//status | grep VmRSSWe use:<br /><br /> $ cat /proc//status | grep VmRSSpeterbehttps://www.blogger.com/profile/02454160645313349401noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-52979107615618745212010-03-12T16:06:13.866+00:002010-03-12T16:06:13.866+00:00To fulfill this need, a while back I wrote Syrupy,...To fulfill this need, a while back I wrote <a href="http://jeetworks.org/programs/syrupy" rel="nofollow">Syrupy</a>, which works on any POSIX-compliant platform that provides "ps".Jeet Sukumaranhttps://www.blogger.com/profile/04874973927331407332noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-51100168072127159582010-03-12T15:42:55.509+00:002010-03-12T15:42:55.509+00:00dowser is also really cool for finding memory leak...dowser is also really cool for finding memory leaks and other surprising memory usage stats. <br /><br />http://www.aminus.net/wiki/DowserUnknownhttps://www.blogger.com/profile/14453164721079039049noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-16200868934335167332010-03-12T13:31:02.104+00:002010-03-12T13:31:02.104+00:00Lawouach: brilliant! psutil looks the ticket. Co...Lawouach: brilliant! psutil looks the ticket. Combined with pympler, that's a lot of information :)René Dudfieldhttps://www.blogger.com/profile/17762358075557755436noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-15293959749934956372010-03-12T13:29:03.477+00:002010-03-12T13:29:03.477+00:00Hi Alex. pympler is very awesome. It seems to lo...Hi Alex. pympler is very awesome. It seems to look at sizes of python objects. Whereas I am interested in the memory usage at the process level. cu.René Dudfieldhttps://www.blogger.com/profile/17762358075557755436noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-70731346720188569372010-03-12T13:27:27.107+00:002010-03-12T13:27:27.107+00:00Have you tried psutil: http://code.google.com/p/ps...Have you tried psutil: http://code.google.com/p/psutil/Unknownhttps://www.blogger.com/profile/04547214668265559853noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-68278239881302801482010-03-12T13:14:42.421+00:002010-03-12T13:14:42.421+00:00You might be able to make something like what you ...You might be able to make something like what you want out of <a href="http://code.google.com/p/pympler/" rel="nofollow">pympler</a>.Alexhttps://www.blogger.com/profile/03849375466967362511noreply@blogger.com