From 6b6568b3395d069818ab71a9c55f6e92300e4751 Mon Sep 17 00:00:00 2001
From: Bob Igo <bob@stormlogic.com>
Date: Tue, 28 Jul 2009 14:16:02 -0400
Subject: graphload uses gnuplot to graph total CPU load; useful in testing

---
 abs/extra-testing/graphload/PKGBUILD     | 16 ++++++++++++++++
 abs/extra-testing/graphload/graphload.sh | 17 +++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100644 abs/extra-testing/graphload/PKGBUILD
 create mode 100755 abs/extra-testing/graphload/graphload.sh

diff --git a/abs/extra-testing/graphload/PKGBUILD b/abs/extra-testing/graphload/PKGBUILD
new file mode 100644
index 0000000..fb73fc1
--- /dev/null
+++ b/abs/extra-testing/graphload/PKGBUILD
@@ -0,0 +1,16 @@
+pkgname=graphload
+pkgver=1
+pkgrel=1
+pkgdesc="command to graph the total CPU utilization for N-core systems for a given interval"
+depends=('gnuplot>=4.2.0')
+license='GPLv2'
+arch=('i686')
+
+build() {
+   LH_ROOT=/usr/LH
+   mkdir -p $startdir/pkg/$LH_ROOT/bin/
+
+   cd $startdir
+   # executables
+   install -m0755 -D graphload.sh  $startdir/pkg/$LH_ROOT/bin/
+}
diff --git a/abs/extra-testing/graphload/graphload.sh b/abs/extra-testing/graphload/graphload.sh
new file mode 100755
index 0000000..79023ec
--- /dev/null
+++ b/abs/extra-testing/graphload/graphload.sh
@@ -0,0 +1,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
-- 
cgit v0.12

