From: Charles Manning Date: Sun, 2 May 2010 21:56:20 +0000 (+1200) Subject: yaffs Clean up exit from plot script X-Git-Tag: pre-name-change~67^2 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=390dac6aa9334603dc13325bfb0511e778e8b926;hp=b951da5d5e13de163785076b4c2709c0c821e20f yaffs Clean up exit from plot script The plot script now cleans up properly after a control-C. Signed-off-by: Charles Manning --- diff --git a/linux-tests/plot_data.sh b/linux-tests/plot_data.sh index a7df698..cd5a1cd 100755 --- a/linux-tests/plot_data.sh +++ b/linux-tests/plot_data.sh @@ -7,6 +7,8 @@ log_file=data gather_delay=1 +done_file=plot_done + # Plot settings trunc_file=trunc_data plot_samples=1000 @@ -14,13 +16,15 @@ plot_delay=2 + + # Gathering task gather_data() { i=0; rm -f $log_file -while true; do +while [ ! -e $done_file ] ; do str=$(cat /proc/yaffs_stats) echo "$i, $str" echo "$i, $str" >> $log_file @@ -44,7 +48,7 @@ echo "set title 'yaffs free space and erased space'" echo $plot_str -while true; do +while [ ! -e $done_file ]; do sleep $plot_delay tail -$plot_samples $log_file > $trunc_file echo replot @@ -52,9 +56,15 @@ done } +rm -f $done_file +trap "touch $done_file" INT echo "Start gathering task in background" gather_data & echo "Run plotting task" drive_gnuplot | gnuplot +wait + +echo "All done" +