Real-Time Monitoring:
Updates every second with the latest CPU and memory stats.
Dynamic Terminal Charts:
Displays live line charts for CPU and memory usage naively in the terminal.
Process Details:
Lists PID, command, CPU, and memory usage for the monitored process.
It will ask for PID or process name after the start command.
npm install
npm run start
It's worth fine-tuning the renderAsciiLineChart
method's third parameter, so you can see something on the charts.
echo "Time,CPU,MEM" > usage_data.csv
while true; do
stats=$(ps -p <PID> -o %cpu,%mem | tail -1)
echo "$(date +%H:%M:%S),$stats" >> usage_data.csv
sleep 1
done
brew install gnuplot
create plot.gnu
file
set datafile separator ","
set title "CPU and Memory Usage"
set xlabel "Time"
set ylabel "Usage (%)"
set xdata time
set timefmt "%H:%M:%S"
set format x "%H:%M"
plot "usage_data.csv" using 1:2 title "CPU" with lines, \
"usage_data.csv" using 1:3 title "Memory" with lines
and run it
gnuplot -p plot.gnu