Mercurial > yaffs-ecoscentric-gpl
changeset 408:fc1d08b30cc0
yaffs: Rationalise plot_data.sh
plot_data.sh now includes all the scripting required to do the plotting.
No longer uses seperate scripts to gather data and drive gnu-plot.
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
| author | Charles Manning <cdhmanning@gmail.com> |
|---|---|
| date | Mon, 26 Apr 2010 14:35:21 +1200 |
| parents | 36a72b45da7c |
| children | b5309c9b6d7f |
| files | linux-tests/drive_gnuplot.sh linux-tests/gather_data.sh linux-tests/plot_data.sh |
| diffstat | 3 files changed, 57 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
deleted file mode 100755 --- a/linux-tests/drive_gnuplot.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# drive_gnuplot syntehsises the commands for driving gnuplot - -the_log_file=data - -plot_str=" plot 'trunc_data' using 1:3 with linespoints title 'free', '' using 1:4 with linespoints title 'erased'" - -echo "set title 'yaffs free space and erased space'" - -echo $plot_str - -while true; do -sleep 1 -tail -500 $the_log_file > trunc_data -echo replot -done -
deleted file mode 100755 --- a/linux-tests/gather_data.sh +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/sh -# gather_data.sh agthers the data to be plotted -# -the_file=data -i=0; -rm -f $the_file - -while true; do -str=$(cat /proc/yaffs_debug) -echo "$i, $str" -echo "$i, $str" >> $the_file -let i=$i+1 -sleep 0.5 -done
--- a/linux-tests/plot_data.sh +++ b/linux-tests/plot_data.sh @@ -1,5 +1,60 @@ #!/bin/sh -# plot_data.sh runs the plot, updating it in realtime +# Script that gathers data erased vs free data from /proc/yaffs_stats and simultaneously \ +# plots it using gnuplot. + + +#Gather settings +log_file=data +gather_delay=1 + +# Plot settings +trunc_file=trunc_data +plot_samples=1000 +plot_delay=2 + + + +# Gathering task + +gather_data() { +i=0; +rm -f $log_file -./drive_gnuplot.sh | gnuplot +while true; do +str=$(cat /proc/yaffs_debug) +echo "$i, $str" +echo "$i, $str" >> $log_file +let i=$i+1 +sleep $gather_delay +done +} + + +# Plotting task +# Periodically creates a truncated version of the log file and +# outputs commands into gnuplot, thus driving gnuplot + +drive_gnuplot(){ +sleep 5 +tail -$plot_samples $log_file > $trunc_file +plot_str=" plot '$trunc_file' using 1:3 with linespoints title 'free', '' using 1:4 with linespoints title 'erased'" + +echo "set title 'yaffs free space and erased space'" + +echo $plot_str + +while true; do +sleep $plot_delay +tail -$plot_samples $log_file > $trunc_file +echo replot +done +} + + + +echo "Start gathering task in background" +gather_data & +echo "Run plotting task" +drive_gnuplot | gnuplot +
