[Livecd-commit] trunk/skeletons/osadl/rootfs/bin/latency-demo
svnusers at osadl.org
svnusers at osadl.org
Wed May 9 15:03:26 CEST 2007
Repository: /var/svn-osadl-projects/livecd/
Revision: 8
Author: tb10alj
Log message:
Integration of Carsten's changes to latency-demo:
On SMP systems we get a latency-plot for all present CPUs.
Updated trunk/skeletons/osadl/rootfs/bin/latency-demo
Modified: trunk/skeletons/osadl/rootfs/bin/latency-demo
===================================================================
--- trunk/skeletons/osadl/rootfs/bin/latency-demo 2006-09-18 09:30:30 UTC (rev 7)
+++ trunk/skeletons/osadl/rootfs/bin/latency-demo 2007-05-09 13:03:25 UTC (rev 8)
@@ -1,16 +1,17 @@
#!/bin/bash
+defaultseconds=300
+
seconds="$1"
if test -z "$seconds" || test "$seconds" -lt 1
then
- seconds=300
+ seconds=$defaultseconds
fi
latencydata=/tmp/latencydata.$$
maxlatencydata=/tmp/maxlatencydata.$$
-output=/tmp/`basename $0`.pbm
echo Starting load generator in background ...
-( while true; do nice hackbench 30 > /dev/null; done ) &
+( while true; do nice hackbench 30 >/dev/null; done ) &
hackbench_pid=$!
@@ -28,25 +29,37 @@
echo Stopping load generator ...
kill -9 $hackbench_pid
-echo Creating latency plot ...
-grep -v -e '^#' -e 0$ /proc/latency_hist/wakeup_latency/CPU0 | tr -d ' ' >$latencydata
-maxx=`tail -1 $latencydata | cut -f1`
-MAXIMUM=`sort -k2 -n $latencydata | tail -1 | cut -f2`
-echo -e $maxx\\t$MAXIMUM >$maxlatencydata
+echo Creating latency plots ...
-YRANGE=$MAXIMUM*1.5
-CPUFREQ=`cat /proc/cpuinfo | grep MHz | awk '{print $4}'`
-CPUVEND=`cat /proc/cpuinfo | grep vendor_id | awk '{print $3}'`
+MAXPROCESSOR=`grep ^processor /proc/cpuinfo | wc -l`
+MAXPROCESSOR=`expr $MAXPROCESSOR - 1`
+CPU=`grep "^model name" /proc/cpuinfo | head -1 | awk '{print $4 " " $5 " " $9}'`
+outputs=
-echo -e "set title \"Latency on Kernel `uname -r`, CPU Vendor: $CPUVEND, CPU Freq: $CPUFREQ MHz\"\n\
-set terminal pbm color\n\
-set xlabel \"Max. latency $maxx usecs\"\n\
-set logscale x\n\
-set xrange [1:*]\n\
-set yrange [0:$YRANGE]\n\
-set ylabel \"Number of data points\"\n\
-set output \"$output\"\n\
-plot \"$latencydata\" using 1:2 notitle with histeps, \"$maxlatencydata\" using 1:2 notitle with boxes" | gnuplot -persist
+for i in `seq 0 $MAXPROCESSOR`
+do
+ grep -v -e '^#' -e 0$ /proc/latency_hist/wakeup_latency/CPU$i | tr -d ' ' >$latencydata
+ maxx=`tail -1 $latencydata | cut -f1`
+ MAXIMUM=`sort -k2 -n $latencydata | tail -1 | cut -f2`
+ echo -e $maxx\\t$MAXIMUM >$maxlatencydata
+ YRANGE=$MAXIMUM*1.5
+
+ output=/tmp/`basename $0`$i.pbm
+
+ echo -e "set title \"Latency on Kernel `uname -r`, CPU #$i: $CPU\"\n\
+ set terminal pbm color\n\
+ set xlabel \"Max. latency $maxx usecs\"\n\
+ set logscale x\n\
+ set xrange [1:*]\n\
+ set yrange [0:$YRANGE]\n\
+ set ylabel \"Number of data points\"\n\
+ set output \"$output\"\n\
+ plot \"$latencydata\" using 1:2 notitle with histeps, \"$maxlatencydata\" using 1:2 notitle with boxes" | gnuplot -persist
+ outputs="$outputs $output"
+done
+
+echo $outputs > /tmp/`basename $0`.files
+
rm -f $latencydata
rm -f $maxlatencydata
More information about the Livecd-commit
mailing list