Reputation: 147
I am wondering if there is any way to compare the peak memory usage of different process in bash script. I want to compare the memory usage of different program which are working in the same data set. my bash file is something like below:
#!/bin/bash
./program_1 parameterSet1
./program_2 parameterSet2
./program_3 parameterSet3
I want to store the max memory usage of each process separately. It might be useful to point out that each program takes several minutes to finish, how can i monitor max memory usage of that program simultaneously. Should I write another bash script?
Many thanks in advance
Upvotes: 1
Views: 419
Reputation: 2883
/usr/bin/time -f "process 1 max RSS %M kbytes" ./program1 parameterSet1
/usr/bin/time -f "process 2 max RSS %M kbytes" ./program2 parameterSet2
Will put the maximum resident set size on stderr for the program. You can tailor the format string (as I did) or redirect outputs to trace each separate process.
Upvotes: 2