Is there a tool that will run a command-line and report how much RAM was used total?
I'm imagining something analogous to /usr/bin/time
Is there a tool that will run a command-line and report how much RAM was used total?
I'm imagining something analogous to /usr/bin/time
Here is (based on the other answers) a very simple script that watches an already running process. You just run it with the pid of the process you want to watch as the argument:
Example usage:
(This is an already answered, old question.. but just for the record :)
I was inspired by Yang's script, and came up with this small tool, named memusg. I simply increased the sampling rate to 0.1 to handle much short living processes. Instead of monitoring a single process, I made it measure rss sum of the process group. (Yeah, I write lots of separate programs that work together) It currently works on Mac OS X and Linux. The usage had to be similar to that of
time
:It only shows the peak for the moment, but I'm interested in slight extensions for recording other (rough) statistics.
It's good to have such simple tool for just taking a look before we start any serious profiling.
Perhaps (gnu) time(1) already does what you want. For instance:
But other profiling tools may give more accurate results depending on what you are looking for.
'htop' is best command for see which process is using how much RAM.....
for more detail http://manpages.ubuntu.com/manpages/precise/man1/htop.1.html
[Edit: Works on Ubuntu 14.04:
/usr/bin/time -v command
Make sure to use the full path.]Looks like
/usr/bin/time
does give you that info, if you pass-v
(this is on Ubuntu 8.10). See, e.g.,Maximum resident set size
below:Well, if you really want to show the memory peak and some more in-depth statistics i recommend using a profiler such as valgrind. A nice valgrind front-end is alleyoop.