Mods for Linux 3.0 and fix a typo
[yaffs2.git] / linux-tests / plot_data.sh
index a1c6960772ceb146b856e39a9d000cce07763b19..e7482bc49f8650fece50e9d9e1defffd6616fb32 100755 (executable)
@@ -25,11 +25,30 @@ i=0;
 rm -f $log_file
 
 while [ ! -e $done_file ] ; do
-str=$(cat /proc/yaffs_stats)
-echo "$i, $str" 
-echo "$i, $str"  >> $log_file
-i=$(($i+1))
-sleep $gather_delay
+       xx='1'
+       erased_blocks='2'
+       while [ "$xx" !=  "$erased_blocks" ] ; do
+               xx=$(cat /proc/yaffs | grep n_erased_blocks | cut -d ' ' -f 2)
+               erased_blocks=$(cat /proc/yaffs | grep n_erased_blocks | cut -d ' ' -f 2)
+               if [ -z "$xx" ] ; then
+                       xx='bad value'
+               fi
+       done
+       xx='1'
+       free_chunks='2'
+       while [ "$xx" != "$free_chunks" ] ; do
+               xx=$(cat /proc/yaffs | grep n_free_chunks | cut -d ' ' -f 2)
+               free_chunks=$(cat /proc/yaffs | grep n_free_chunks | cut -d ' ' -f 2)
+               if [ -z "$xx" ] ; then
+                       xx='bad value'
+               fi
+       done
+       erased_chunks=$(($erased_blocks*64))
+       str=" $i, 0, $free_chunks, $erased_chunks"
+       echo $str
+       echo $str  >> $log_file
+       i=$(($i+1))
+       sleep $gather_delay
 done
 }
 
@@ -44,7 +63,10 @@ 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 "set title 'yaffs free space vs erased space'"
+echo "set xlabel 'seconds'"
+echo "set ylabel 'chunks'"
+
 
 echo $plot_str