2 # Script that gathers data erased vs free data from /proc/yaffs_stats and simultaneously \
3 # plots it using gnuplot.
27 while [ ! -e $done_file ] ; do
30 while [ "$xx" != "$erased_blocks" ] ; do
31 xx=$(cat /proc/yaffs | grep n_erased_blocks | cut -d ' ' -f 2)
32 erased_blocks=$(cat /proc/yaffs | grep n_erased_blocks | cut -d ' ' -f 2)
33 if [ -z "$xx" ] ; then
39 while [ "$xx" != "$free_chunks" ] ; do
40 xx=$(cat /proc/yaffs | grep n_free_chunks | cut -d ' ' -f 2)
41 free_chunks=$(cat /proc/yaffs | grep n_free_chunks | cut -d ' ' -f 2)
42 if [ -z "$xx" ] ; then
46 erased_chunks=$(($erased_blocks*64))
47 str=" $i, 0, $free_chunks, $erased_chunks"
49 echo $str >> $log_file
57 # Periodically creates a truncated version of the log file and
58 # outputs commands into gnuplot, thus driving gnuplot
62 tail -$plot_samples $log_file > $trunc_file
64 plot_str=" plot '$trunc_file' using 1:3 with linespoints title 'free', '' using 1:4 with linespoints title 'erased'"
66 echo "set title 'yaffs free space vs erased space'"
67 echo "set xlabel 'seconds'"
68 echo "set ylabel 'chunks'"
73 while [ ! -e $done_file ]; do
75 tail -$plot_samples $log_file > $trunc_file
82 trap "touch $done_file" INT
84 echo "Start gathering task in background"
86 echo "Run plotting task"
87 drive_gnuplot | gnuplot