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

Option for one unit size #39

Open GioMac opened 6 years ago

GioMac commented 6 years ago

It's very hard to parse the output, because we need to differentiate KiB and GiB, convert them to use in automation, monitoring tools etc. Can we please have an option to use only MiB's or B's?

pixelb commented 6 years ago

Note the --total option outputs a single number unformatted, and is meant for automated tools. Is it practical to do other automated processing on the output?

neilser commented 6 years ago

I'm interested in this option as well. I have a few hundred php-fpm processes for which I want to check memory usage vs. the number of requests served. ps_mem does a lovely job of getting the memory usage, and although I can readily extract the memory info per process with "ps_mem -d" and then a bit of grep/awk etc., the output will be mangled if any of the processes ever cross a human boundary (e.g. kiB instead of MiB). I can hack my own version to do it this way of course, but having it in the master version seems more attractive :-D I'm happy to propose a patch if that helps. (Btw: seriously useful bit of code, this! I haven't found a built-in utility which does the same thing, which is baffling after all these years.)

allanlaal commented 2 years ago

duplicate of #32