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 time
. In fact, in this case it's really 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.
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.