![]() ![]() Myself 8707 3.1 0.1 4399204 23500 s013 S+ 10:19AM 0:03.54 the-programs-name -fooĪnd then I have to manually extract the VSZ column and multiply that number by 1024 because it's actually a page count, not a byte count so the above line represents 4'504'784'896 actual bytes. This produces output like USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND ![]() Os.system('ps u -p $(pgrep the-programs-name)') The exact meaning of the byte count doesn't matter, just as long as it goes up in the natural way with each malloc or sbrk or whatever. It needs to be something non-interactive so that I can get it from the Python script, and I would like it to report a count of bytes. Problem is, I don't know any good way to get the process's memory usage. ![]() Then I can do some arithmetic to find out roughly how much memory is used by each piece of data added. Use it well.I'm trying to measure the increase in memory footprint of a program as I add data to it, so I've written a Python script that does basically start_the_program() This example is a brief overview of what's possible to learn about a single process. You can also use it to analyze a memory value that always increases and never decreases or to locate the culprit of a memory leak. You can use pmap to monitor the movement of memory across a particular time range. The value is anonymous memory mapping, which is part of the memory populated with data not taken from the filesystem but allocated when needed. The pmap utility gathers most of its information from the /proc/PID/smaps file and makes it friendly to humans.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |