title: How can I determine max memory usage of a process in Linux?
body: <p>I have a program that's running in two different modes.  I want to compare the two modes with regard to runtime and memory requirements.  Determining runtime is easy with using <code>time</code>.  In fact, in this case it's <em>really</em> easy because the program reports both the CPU time and the wallclock time at the end of the test.  However, determining memory usage is a bit harder.  </p>
  
  <p>How can I get details of the memory usage of the process throughout its lifetime?  I want to know both the maximum usage and the average.  In fact, ideally I'd like some graph of memory usage throughout the life of the run.</p>