equivalent of time for memory checking
-
03-07-2019 - |
Question
we can use time
in a unix environment to see how long something took...
shell> time some_random_command
real 0m0.709s
user 0m0.008s
sys 0m0.012s
is there an equivalent for recording memory usage of the process(es)?
in particular i'm interested in peak allocation.
Solution
Check the man page for time. You can specify a format string where it is possible to output memory information. For example:
>time -f"mem: %M" some_random_command mem: NNNN
will output maximum resident set size of the process during its lifetime, in Kilobytes.
OTHER TIPS
Can you not use ps? e.g. ps v <pid>
will return memory information.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow