![]() ![]() I'm on Mac OSX, so I don't have access to /proc/$(pgrep the-programs-name) as far as I know. I'm not sure if it's going up at the same rate, since its granularity is so low that's why I really want a byte count!) (This number is also vastly different from either VSZ or RSS. This produces output like 15M the-programs-nameĪnd then I have to manually extract the first number and multiply it by 1MB so the above line represents 15'000'000 actual bytes at a ridiculously low granularity. Os.system('top -pid $(pgrep the-programs-name) -stats mem,command -l 1 | grep the-programs-name') (Or maybe this discounts swap, so I should look at VSZ? But that's not right either.) ![]() 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. each of mappings there series of lines follows: or /proc/pid/statm provides information memory usage, measured in pages. use: /proc/pid/smaps (since linux 2.6.14) file shows memory consumption each of processs mappings. Then I can do some arithmetic to find out roughly how much memory is used by each piece of data added. having pid number of subprocess can read info proc file-system. The conky code was recently modified to auto-sense the GPU.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() In this instance I've booted using the nVidia GTX 970M rather than the integrated GPU: The conky code adapts depending on if booted with prime-select intel or prime-select nvidia: nVidia GPU GTX 970M In this instance I've booted using the integrated GPU rather than the nVidia GTX 970M: Installation is straightforward: sudo apt install conky I like to use conky as a real-time monitor for both CPU and GPU. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |