How to record memory usage?
You can use the following command in bash like so:
for i in `seq 0 60`; do
echo `cat /proc/meminfo | grep Active: | sed 's/Active: //g'` >> usage.txt
sleep 1m
done
This command will record the current memory use to a file named 'usage.txt' every minute for the duration of 1 hour.
If you wish, you can change the usage.txt
part of the command to save under a different name. You can also change the sleep 1m
command to alter the time between each entry and the '60' in the seq
section at the top to change the number of entries to be recorded.
When you have finished making your entries, you will have a text file of entries that can be imported into a spreadsheet for easy comparison.
EDIT: If you wish to also record the total memory with each entry, you can use the following commands:
for i in `seq 0 60`; do
echo `cat /proc/meminfo | grep Active: | sed 's/Active: //g'`/`cat /proc/meminfo | grep MemTotal: | sed 's/MemTotal: //g'` >> usage.txt
sleep 1m
done
These commands will instead record entries in the form of <active>/<total>