How To Extract Values From top And Plot Them

“Many researchers who are doing performance evaluation and
benchmarking need to capture the values of the CPU and the RAM.
Others might need to capture the throughput as well. In this short
tutorial I will show how I capture the CPU and RAM values from
‘top’ and then extract them in one line command.

“In order to capture and store top output, use the batch mode
‘top -b’. Top by default updates its reading each 10 seconds.
However, some researchers need the values each second. Well, it is
easy just pass the parameter d, the command becomes ‘top -b -d 1’.
1 here is one second. This command will capture the top output each
second. But it is not yet done. You need to store it…”