pixelb / ps_mem

A utility to accurately report the in core memory usage for a program
GNU Lesser General Public License v2.1
1.56k stars 284 forks source link

Remote machine support #27

Open acmay opened 7 years ago

acmay commented 7 years ago

I would like to use this with some embedded targets where python isn't an option. I was able to hack something up to get the proc PID files onto a machine with python. Then I was able to change the proc.path/proc.open functions to be something that runs from the current directory to generate results based off the local files rather than local running machine.

I had to just skip the exe check to get it to work as well.

Would other people find this useful as a pull request?

pixelb commented 7 years ago

That sounds useful. It might also be useful for debugging

acmay commented 7 years ago

Here is a cut at a patch. 0001-Added-l-dir-option-to-use-a-local-directory-rather-t.txt

pixelb commented 7 years ago

looks good. I might adjust the exception handling a bit as a blanket except: is generally wrong. Anyway I'll apply soon in your name. thanks!

acmay commented 7 years ago

Hopefully I got the cmdline name ordering correct in terms of picking the right thing from cmdline/status/exe.

The change to not need exe shifts the detection of some of the kernel threads, but they still seem to get tossed out ok.

As for the blanket except that is ok, I just don't know python well enough to qualify the ones it can hit. I really did hit the IndexError one when it calculates the Rss value.