summaryrefslogtreecommitdiffstats
path: root/abs/extra-testing/graphload/graphload.sh
blob: 79023ec6e23fbd74a548a751bbe2788e0a3d3ee2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

MYTICKS=100
MYINTERVAL=4 # we sample once every $MYINTERVAL seconds
MYINVERSEINTERVAL=0.25

top -d $MYINVERSEINTERVAL -n $MYTICKS -b -i | grep Cpu | perl -e "while(<>) { split(','); \$load = 100 - substr @_[3], 0, -3; print \$load,\"\n\";}" > profile
perl -e '$second=0; while(<>) { chop(); $load = $_; print "$second $load "; split " ", $load; print @_[0] + @_[1], "\n"; $second+=0.25;}' < profile > points
echo "set grid
set xrange [0: $(($MYTICKS/$MYINTERVAL))]
set yrange [0: 101]
set xtics 0,$MYINVERSEINTERVAL,$(($MYTICKS/$MYINTERVAL))
set xlabel \"time\"
set ylabel \"CPU usage\"
plot \"points\" using 1:2 with lines title 'total load'
replot" > gplot.cmds
gnuplot -persist gplot.cmds