fabianp/memory_profiler — pull request #38 by pgervais (2013-03-07 15:35:11+00:00)
Title: Command-line tool for tracing memory usage of an arbitrary process.

I needed a small command-line tool, so I wrote it based on your module. The name is mprofile.
Typical usage:

mprofile longrunningcommand ...

The script just write a file called "mprofile_.dat" in the current directory. The memory is sampled twice every second.
There is currently no options (no way to change sampling rate or name of output files).

I had to slightly generalise memory_usage(). The "proc" argument can now take a Popen object. This is required for a simple thing: being able to detect when the process terminates (the timeout parameter is functional though).